diff --git a/libs/hardware/InputManager/include/InputManager.h b/libs/hardware/InputManager/include/InputManager.h index 34fc67b..40fda39 100644 --- a/libs/hardware/InputManager/include/InputManager.h +++ b/libs/hardware/InputManager/include/InputManager.h @@ -21,6 +21,13 @@ class InputManager { */ bool isPressed(uint8_t buttonIndex) const; + /** + * Returns true if any button was being held at the time of the last #update() call. + * + * @return true if any button was being held at the time of the last #update() call + */ + bool isAnyPressed() const; + /** * Returns true if the button went from unpressed to pressed between the last two #update() calls. * diff --git a/libs/hardware/InputManager/src/InputManager.cpp b/libs/hardware/InputManager/src/InputManager.cpp index 86442ab..68fb61e 100644 --- a/libs/hardware/InputManager/src/InputManager.cpp +++ b/libs/hardware/InputManager/src/InputManager.cpp @@ -120,6 +120,10 @@ bool InputManager::isPressed(const uint8_t buttonIndex) const { return currentState & (1 << buttonIndex); } +bool InputManager::isAnyPressed() const { + return currentState > 0; +} + bool InputManager::wasPressed(const uint8_t buttonIndex) const { return pressedEvents & (1 << buttonIndex); }