From c3fa9796b54d02f4a1ed5728494a714fef6ba117 Mon Sep 17 00:00:00 2001 From: ion098 <146852218+ion098@users.noreply.github.com> Date: Fri, 24 May 2024 21:33:58 +0000 Subject: [PATCH] add operator bool to Button --- include/gamepad/controller.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/gamepad/controller.hpp b/include/gamepad/controller.hpp index d7af3b1..7ba75ef 100644 --- a/include/gamepad/controller.hpp +++ b/include/gamepad/controller.hpp @@ -35,6 +35,9 @@ class Button { uint32_t onRelease(std::function func) const; uint32_t addListener(EventType event, std::function func) const; bool removeListener(uint32_t id) const; + explicit operator bool() const { + return is_pressed; + } private: void update(bool is_held);