diff --git a/source/input.cpp b/source/input.cpp index 31ab93c..847f755 100644 --- a/source/input.cpp +++ b/source/input.cpp @@ -325,17 +325,6 @@ void Input::initSDLGamePad() { } } -void Input::resetJustPressed() { - for (auto& key : keyboard_.bindings) { - key.second.just_pressed = false; - } - for (auto& gamepad : gamepads_) { - for (auto& binding : gamepad->bindings) { - binding.second.just_pressed = false; - } - } -} - void Input::resetInputStates() { // Resetear todos los KeyBindings.active a false for (auto& key : keyboard_.bindings) { @@ -360,7 +349,7 @@ void Input::update() { bool key_is_down_now = key_states[binding.second.scancode]; // El estado .is_held del fotograma anterior nos sirve para saber si es un pulso nuevo - binding.second.just_pressed = binding.second.just_pressed || (key_is_down_now && !binding.second.is_held); + binding.second.just_pressed = key_is_down_now && !binding.second.is_held; binding.second.is_held = key_is_down_now; } @@ -378,16 +367,6 @@ void Input::update() { auto Input::handleEvent(const SDL_Event& event) -> std::string { switch (event.type) { - case SDL_EVENT_KEY_DOWN: - if (!event.key.repeat) { - for (auto& [action, binding] : keyboard_.bindings) { - if (binding.scancode == event.key.scancode) { - binding.just_pressed = true; - break; - } - } - } - break; case SDL_EVENT_GAMEPAD_ADDED: return addGamepad(event.gdevice.which); case SDL_EVENT_GAMEPAD_REMOVED: diff --git a/source/input.hpp b/source/input.hpp index 6fc604f..bf92961 100644 --- a/source/input.hpp +++ b/source/input.hpp @@ -177,7 +177,6 @@ class Input { // --- Métodos de reseteo de estado de entrada --- void resetInputStates(); - void resetJustPressed(); // --- Eventos --- auto handleEvent(const SDL_Event& event) -> std::string; diff --git a/source/sections/game.cpp b/source/sections/game.cpp index 492eee1..f7f707b 100644 --- a/source/sections/game.cpp +++ b/source/sections/game.cpp @@ -1128,7 +1128,6 @@ auto Game::allPlayersAreNotPlaying() -> bool { // Comprueba los eventos que hay en cola void Game::handleEvents() { - input_->resetJustPressed(); SDL_Event event; while (SDL_PollEvent(&event)) { switch (event.type) {