From 4b4992185fa2c27d5d93898001c35c08c057c0ea Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Thu, 14 Aug 2025 12:54:16 -0400 Subject: [PATCH] Needed a default of no Modifiers to click_on since that's a very common operation. Also a constant to represent that. --- include/guecs/ui.hpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/include/guecs/ui.hpp b/include/guecs/ui.hpp index 2d30731..af61965 100644 --- a/include/guecs/ui.hpp +++ b/include/guecs/ui.hpp @@ -26,13 +26,16 @@ namespace guecs { }; enum class ModBit { - hover=0, - left=1, - right=2 + NONE=0, + hover=1, + left=2, + right=3 }; using Modifiers = std::bitset<16>; + constexpr const Modifiers NO_MODS{size_t(ModBit::NONE)}; + struct Clickable { /* This is actually called by UI::mouse and passed the entity ID of the * button pressed so you can interact with it in the event handler. @@ -74,7 +77,7 @@ namespace guecs { void init(); void render(sf::RenderWindow& window); bool mouse(float x, float y, Modifiers mods); - void click_on(Entity slot_id, Modifiers mods); + void click_on(Entity slot_id, Modifiers mods=NO_MODS); void debug_layout(sf::RenderWindow& window); Entity entity() { return ++entity_count; }