feat(menu): submenú Controls i bloqueig de polling amb menú obert
This commit is contained in:
1 parent
350625dec0
commit
fb40d0effb
8 files changed
+229
-7
No files matched your search
@@ -8,6 +8,7 @@
|
||||
#include <stdexcept>
|
||||
#include <utility>
|
||||
|
||||
#include "core/input/input_state.hpp"
|
||||
#include "core/resources/resource_cache.hpp"
|
||||
#include "core/resources/resource_helper.hpp"
|
||||
#include "external/fkyaml_node.hpp"
|
||||
@@ -57,7 +58,11 @@ Player::Player(const std::string& anim_key, float x, float y, const Controls& co
|
||||
}
|
||||
|
||||
void Player::update(float delta_time) {
|
||||
const bool* keys = SDL_GetKeyboardState(nullptr);
|
||||
// Via `InputState` en lloc de `SDL_GetKeyboardState` directe: quan el
|
||||
// service menu (o qualsevol UI modal) està obert, el wrapper retorna
|
||||
// un buffer tot-a-zero perquè el jugador no es mogui mentre l'usuari
|
||||
// navega el menú. Polling-blocked; veure `core/input/input_state.hpp`.
|
||||
const bool* keys = InputState::getKeyboardState();
|
||||
float vx = 0.0F;
|
||||
float vy = 0.0F;
|
||||
if (keys[controls_.left]) { vx -= SPEED_PX_PER_S; }
|
||||
|
||||
Reference in new issue
Block a user