From 3c8f936b31c310a3ad037cc2e260b53d07577fcf Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Sat, 16 Jan 2021 10:34:39 -0500 Subject: input_interpreter: Add method to check for a button press state This allows to check for continuous input for the duration of a button press/hold --- src/core/frontend/input_interpreter.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/core/frontend/input_interpreter.cpp') diff --git a/src/core/frontend/input_interpreter.cpp b/src/core/frontend/input_interpreter.cpp index 66ae506cd..ec5fe660e 100644 --- a/src/core/frontend/input_interpreter.cpp +++ b/src/core/frontend/input_interpreter.cpp @@ -25,6 +25,10 @@ void InputInterpreter::PollInput() { button_states[current_index] = button_state; } +bool InputInterpreter::IsButtonPressed(HIDButton button) const { + return (button_states[current_index] & (1U << static_cast(button))) != 0; +} + bool InputInterpreter::IsButtonPressedOnce(HIDButton button) const { const bool current_press = (button_states[current_index] & (1U << static_cast(button))) != 0; -- cgit v1.2.3