treballant en redefinir els botons i axis del joystick

This commit is contained in:
2025-11-02 18:57:24 +01:00
parent 6c766be023
commit b79f30a57b
6 changed files with 243 additions and 8 deletions

View File

@@ -58,6 +58,28 @@ struct ControlScheme {
key_jump(jump) {}
};
// Estructura para las opciones de control del gamepad/joystick
// Los valores pueden ser:
// - 0-20+: Botones SDL_GamepadButton (DPAD, face buttons, shoulders, etc.)
// - 100: L2 trigger
// - 101: R2 trigger
// - 200: Left stick X axis (negativo = izquierda)
// - 201: Left stick X axis (positivo = derecha)
struct GamepadControlScheme {
int button_left{static_cast<int>(SDL_GAMEPAD_BUTTON_DPAD_LEFT)}; // Botón para mover a la izquierda (por defecto: DPAD_LEFT)
int button_right{static_cast<int>(SDL_GAMEPAD_BUTTON_DPAD_RIGHT)}; // Botón para mover a la derecha (por defecto: DPAD_RIGHT)
int button_jump{static_cast<int>(SDL_GAMEPAD_BUTTON_WEST)}; // Botón para saltar (por defecto: WEST/X button)
// Constructor por defecto
GamepadControlScheme() = default;
// Constructor
GamepadControlScheme(int left, int right, int jump)
: button_left(left),
button_right(right),
button_jump(jump) {}
};
// Estructura para albergar trucos
struct Cheat {
enum class State : bool {
@@ -234,6 +256,7 @@ inline Notification notifications{}; // Opciones relativas a las n
inline Window window{}; // Opciones relativas a la ventana
inline Audio audio{}; // Opciones relativas al audio
inline ControlScheme controls{}; // Teclas usadas para jugar
inline GamepadControlScheme gamepad_controls{}; // Botones del gamepad usados para jugar
// --- Funciones ---
void init(); // Crea e inicializa las opciones del programa