|
|
@ -26,13 +26,16 @@ namespace guecs { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
enum class ModBit { |
|
|
|
enum class ModBit { |
|
|
|
hover=0, |
|
|
|
NONE=0, |
|
|
|
left=1, |
|
|
|
hover=1, |
|
|
|
right=2 |
|
|
|
left=2, |
|
|
|
|
|
|
|
right=3 |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
using Modifiers = std::bitset<16>; |
|
|
|
using Modifiers = std::bitset<16>; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
constexpr const Modifiers NO_MODS{size_t(ModBit::NONE)}; |
|
|
|
|
|
|
|
|
|
|
|
struct Clickable { |
|
|
|
struct Clickable { |
|
|
|
/* This is actually called by UI::mouse and passed the entity ID of the
|
|
|
|
/* 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. |
|
|
|
* button pressed so you can interact with it in the event handler. |
|
|
@ -74,7 +77,7 @@ namespace guecs { |
|
|
|
void init(); |
|
|
|
void init(); |
|
|
|
void render(sf::RenderWindow& window); |
|
|
|
void render(sf::RenderWindow& window); |
|
|
|
bool mouse(float x, float y, Modifiers mods); |
|
|
|
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); |
|
|
|
void debug_layout(sf::RenderWindow& window); |
|
|
|
|
|
|
|
|
|
|
|
Entity entity() { return ++entity_count; } |
|
|
|
Entity entity() { return ++entity_count; } |
|
|
|