Skip to content

Commit

Permalink
add operator bool to Button
Browse files Browse the repository at this point in the history
  • Loading branch information
ion098 committed May 24, 2024
1 parent 7c5ac05 commit c3fa979
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/gamepad/controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ class Button {
uint32_t onRelease(std::function<void(void)> func) const;
uint32_t addListener(EventType event, std::function<void(void)> func) const;
bool removeListener(uint32_t id) const;
explicit operator bool() const {
return is_pressed;
}
private:

void update(bool is_held);
Expand Down

0 comments on commit c3fa979

Please sign in to comment.