Needed a default of no Modifiers to click_on since that's a very common operation. Also a constant to represent that.

main
Zed A. Shaw 2 days ago
parent 5d0d8b16fc
commit 4b4992185f
  1. 11
      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; }

Loading…
Cancel
Save