millorada la gestio d'escenes i opcions

This commit is contained in:
2025-12-04 11:51:41 +01:00
parent f8c5207d5c
commit 330044e10f
12 changed files with 195 additions and 59 deletions
+10 -4
View File
@@ -5,11 +5,15 @@
#include "core/input/mouse.hpp"
#include "core/rendering/sdl_manager.hpp"
#include "gestor_escenes.hpp"
#include "context_escenes.hpp"
// Using declarations per simplificar el codi
using GestorEscenes::ContextEscenes;
using Escena = ContextEscenes::Escena;
namespace GlobalEvents {
bool handle(const SDL_Event& event, SDLManager& sdl) {
bool handle(const SDL_Event& event, SDLManager& sdl, ContextEscenes& context) {
// Tecles globals de finestra (F1/F2/F3)
if (event.type == SDL_EVENT_KEY_DOWN) {
switch (event.key.key) {
@@ -26,7 +30,8 @@ bool handle(const SDL_Event& event, SDLManager& sdl) {
sdl.toggleVSync();
return true;
case SDLK_ESCAPE:
GestorEscenes::actual = GestorEscenes::Escena::EIXIR;
context.canviar_escena(Escena::EIXIR);
GestorEscenes::actual = Escena::EIXIR;
return true;
default:
break;
@@ -35,7 +40,8 @@ bool handle(const SDL_Event& event, SDLManager& sdl) {
// Tancar finestra
if (event.type == SDL_EVENT_QUIT) {
GestorEscenes::actual = GestorEscenes::Escena::EIXIR;
context.canviar_escena(Escena::EIXIR);
GestorEscenes::actual = Escena::EIXIR;
return true;
}