les tecles de control estan definides al fitxer de configuracio

This commit is contained in:
2025-11-02 17:08:56 +01:00
parent 9102c6a65e
commit ba06bccabc
7 changed files with 57 additions and 19 deletions

View File

@@ -13,11 +13,13 @@
// --- Namespace Options: gestión de configuración y opciones del juego ---
namespace Options {
// Tipos de control de teclado
/*
enum class ControlScheme {
CURSOR,
OPQA,
WASD
};
*/
} // namespace Options
@@ -40,6 +42,22 @@ struct Notification {
color(c) {}
};
// Estructura para las opciones de control de teclado
struct ControlScheme {
SDL_Scancode key_left{SDL_SCANCODE_LEFT}; // Tecla para mover a la izquierda
SDL_Scancode key_right{SDL_SCANCODE_RIGHT}; // Tecla para mover a la derecha
SDL_Scancode key_jump{SDL_SCANCODE_UP}; // Tecla para saltar
// Constructor por defecto
ControlScheme() = default;
// Constructor
ControlScheme(SDL_Scancode left, SDL_Scancode right, SDL_Scancode jump)
: key_left(left),
key_right(right),
key_jump(jump) {}
};
// Estructura para albergar trucos
struct Cheat {
enum class State : bool {
@@ -215,7 +233,7 @@ inline Stats stats{}; // Datos con las estadisticas
inline Notification notifications{}; // Opciones relativas a las notificaciones;
inline Window window{}; // Opciones relativas a la ventana
inline Audio audio{}; // Opciones relativas al audio
inline ControlScheme keys{ControlScheme::CURSOR}; // Teclas usadas para jugar
inline ControlScheme controls{}; // Teclas usadas para jugar
// --- Funciones ---
void init(); // Crea e inicializa las opciones del programa