Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions libs/hardware/InputManager/include/InputManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
4 changes: 4 additions & 0 deletions libs/hardware/InputManager/src/InputManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down