forked from jaildesigner-jailgames/jaildoctors_dilemma
linter
This commit is contained in:
@@ -30,28 +30,28 @@ Input::Input(std::string game_controller_db_path)
|
||||
// Inicializar bindings del teclado
|
||||
keyboard_.bindings = {
|
||||
// Movimiento del jugador
|
||||
{Action::LEFT, KeyState{SDL_SCANCODE_LEFT}},
|
||||
{Action::RIGHT, KeyState{SDL_SCANCODE_RIGHT}},
|
||||
{Action::JUMP, KeyState{SDL_SCANCODE_UP}},
|
||||
{Action::LEFT, KeyState{.scancode = SDL_SCANCODE_LEFT}},
|
||||
{Action::RIGHT, KeyState{.scancode = SDL_SCANCODE_RIGHT}},
|
||||
{Action::JUMP, KeyState{.scancode = SDL_SCANCODE_UP}},
|
||||
|
||||
// Inputs de control
|
||||
{Action::ACCEPT, KeyState{SDL_SCANCODE_RETURN}},
|
||||
{Action::CANCEL, KeyState{SDL_SCANCODE_ESCAPE}},
|
||||
{Action::EXIT, KeyState{SDL_SCANCODE_ESCAPE}},
|
||||
{Action::ACCEPT, KeyState{.scancode = SDL_SCANCODE_RETURN}},
|
||||
{Action::CANCEL, KeyState{.scancode = SDL_SCANCODE_ESCAPE}},
|
||||
{Action::EXIT, KeyState{.scancode = SDL_SCANCODE_ESCAPE}},
|
||||
|
||||
// Inputs de sistema
|
||||
{Action::WINDOW_DEC_ZOOM, KeyState{SDL_SCANCODE_F1}},
|
||||
{Action::WINDOW_INC_ZOOM, KeyState{SDL_SCANCODE_F2}},
|
||||
{Action::TOGGLE_FULLSCREEN, KeyState{SDL_SCANCODE_F3}},
|
||||
{Action::TOGGLE_SHADERS, KeyState{SDL_SCANCODE_F4}},
|
||||
{Action::NEXT_PALETTE, KeyState{SDL_SCANCODE_F5}},
|
||||
{Action::PREVIOUS_PALETTE, KeyState{SDL_SCANCODE_F6}},
|
||||
{Action::TOGGLE_INTEGER_SCALE, KeyState{SDL_SCANCODE_F7}},
|
||||
{Action::TOGGLE_MUSIC, KeyState{SDL_SCANCODE_F8}},
|
||||
{Action::TOGGLE_BORDER, KeyState{SDL_SCANCODE_F9}},
|
||||
{Action::TOGGLE_VSYNC, KeyState{SDL_SCANCODE_F10}},
|
||||
{Action::PAUSE, KeyState{SDL_SCANCODE_F11}},
|
||||
{Action::TOGGLE_DEBUG, KeyState{SDL_SCANCODE_F12}}};
|
||||
{Action::WINDOW_DEC_ZOOM, KeyState{.scancode = SDL_SCANCODE_F1}},
|
||||
{Action::WINDOW_INC_ZOOM, KeyState{.scancode = SDL_SCANCODE_F2}},
|
||||
{Action::TOGGLE_FULLSCREEN, KeyState{.scancode = SDL_SCANCODE_F3}},
|
||||
{Action::TOGGLE_SHADERS, KeyState{.scancode = SDL_SCANCODE_F4}},
|
||||
{Action::NEXT_PALETTE, KeyState{.scancode = SDL_SCANCODE_F5}},
|
||||
{Action::PREVIOUS_PALETTE, KeyState{.scancode = SDL_SCANCODE_F6}},
|
||||
{Action::TOGGLE_INTEGER_SCALE, KeyState{.scancode = SDL_SCANCODE_F7}},
|
||||
{Action::TOGGLE_MUSIC, KeyState{.scancode = SDL_SCANCODE_F8}},
|
||||
{Action::TOGGLE_BORDER, KeyState{.scancode = SDL_SCANCODE_F9}},
|
||||
{Action::TOGGLE_VSYNC, KeyState{.scancode = SDL_SCANCODE_F10}},
|
||||
{Action::PAUSE, KeyState{.scancode = SDL_SCANCODE_F11}},
|
||||
{Action::TOGGLE_DEBUG, KeyState{.scancode = SDL_SCANCODE_F12}}};
|
||||
|
||||
initSDLGamePad(); // Inicializa el subsistema SDL_INIT_GAMEPAD
|
||||
}
|
||||
|
||||
@@ -41,15 +41,15 @@ class Input {
|
||||
};
|
||||
|
||||
struct Keyboard {
|
||||
std::unordered_map<Action, KeyState> bindings{}; // Mapa de acciones a estados de tecla
|
||||
std::unordered_map<Action, KeyState> bindings; // Mapa de acciones a estados de tecla
|
||||
};
|
||||
|
||||
struct Gamepad {
|
||||
SDL_Gamepad* pad{nullptr}; // Puntero al gamepad SDL
|
||||
SDL_JoystickID instance_id{0}; // ID de instancia del joystick
|
||||
std::string name{}; // Nombre del gamepad
|
||||
std::string path{}; // Ruta del dispositivo
|
||||
std::unordered_map<Action, ButtonState> bindings{}; // Mapa de acciones a estados de botón
|
||||
std::string name; // Nombre del gamepad
|
||||
std::string path; // Ruta del dispositivo
|
||||
std::unordered_map<Action, ButtonState> bindings; // Mapa de acciones a estados de botón
|
||||
|
||||
explicit Gamepad(SDL_Gamepad* gamepad)
|
||||
: pad(gamepad),
|
||||
@@ -58,9 +58,9 @@ class Input {
|
||||
path(std::string(SDL_GetGamepadPath(pad))),
|
||||
bindings{
|
||||
// Movimiento del jugador
|
||||
{Action::LEFT, ButtonState{static_cast<int>(SDL_GAMEPAD_BUTTON_DPAD_LEFT)}},
|
||||
{Action::RIGHT, ButtonState{static_cast<int>(SDL_GAMEPAD_BUTTON_DPAD_RIGHT)}},
|
||||
{Action::JUMP, ButtonState{static_cast<int>(SDL_GAMEPAD_BUTTON_WEST)}}} {}
|
||||
{Action::LEFT, ButtonState{.button = static_cast<int>(SDL_GAMEPAD_BUTTON_DPAD_LEFT)}},
|
||||
{Action::RIGHT, ButtonState{.button = static_cast<int>(SDL_GAMEPAD_BUTTON_DPAD_RIGHT)}},
|
||||
{Action::JUMP, ButtonState{.button = static_cast<int>(SDL_GAMEPAD_BUTTON_WEST)}}} {}
|
||||
|
||||
~Gamepad() {
|
||||
if (pad != nullptr) {
|
||||
@@ -134,7 +134,7 @@ class Input {
|
||||
// --- Variables miembro ---
|
||||
static Input* instance; // Instancia única del singleton
|
||||
|
||||
Gamepads gamepads_{}; // Lista de gamepads conectados
|
||||
Gamepads gamepads_; // Lista de gamepads conectados
|
||||
Keyboard keyboard_{}; // Estado del teclado
|
||||
std::string gamepad_mappings_file_{}; // Ruta al archivo de mappings
|
||||
std::string gamepad_mappings_file_; // Ruta al archivo de mappings
|
||||
};
|
||||
Reference in New Issue
Block a user