Add the buttons I'll need for the next round of development.
This commit is contained in:
parent
dfd3118d04
commit
87459d41bb
2 changed files with 14 additions and 6 deletions
|
@ -16,21 +16,28 @@ namespace gui {
|
||||||
"[item_4 | item_5 |item_6 | item_7 ]"
|
"[item_4 | item_5 |item_6 | item_7 ]"
|
||||||
"[item_8 | item_9 |item_10| item_11]"
|
"[item_8 | item_9 |item_10| item_11]"
|
||||||
"[item_12| item_13|item_14|item_15 ]"
|
"[item_12| item_13|item_14|item_15 ]"
|
||||||
"[_ | %(100,50)close| _]"
|
"[ =take_all | =close| =destroy]"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LootUI::make_button(const std::string &name, const std::wstring& label, Events::GUI event) {
|
||||||
|
|
||||||
|
auto button = $gui.entity(name);
|
||||||
|
$gui.set<guecs::Rectangle>(button, {});
|
||||||
|
$gui.set<guecs::Label>(button, {label});
|
||||||
|
$gui.set<guecs::Clickable>(button,
|
||||||
|
guecs::make_action($level, event));
|
||||||
|
}
|
||||||
|
|
||||||
void LootUI::init() {
|
void LootUI::init() {
|
||||||
using guecs::THEME;
|
using guecs::THEME;
|
||||||
auto bg_color = THEME.DARK_LIGHT;
|
auto bg_color = THEME.DARK_LIGHT;
|
||||||
bg_color.a = 140;
|
bg_color.a = 140;
|
||||||
$gui.set<Background>($gui.MAIN, {$gui.$parser, bg_color});
|
$gui.set<Background>($gui.MAIN, {$gui.$parser, bg_color});
|
||||||
|
|
||||||
auto close = $gui.entity("close");
|
make_button("close", L"CLOSE", Events::GUI::LOOT_CLOSE);
|
||||||
$gui.set<guecs::Rectangle>(close, {});
|
make_button("take_all", L"TAKE ALL", Events::GUI::LOOT_CLOSE);
|
||||||
$gui.set<guecs::Label>(close, {L"CLOSE"});
|
make_button("destroy", L"DESTROY", Events::GUI::LOOT_CLOSE);
|
||||||
$gui.set<guecs::Clickable>(close,
|
|
||||||
guecs::make_action($level, Events::GUI::LOOT_CLOSE));
|
|
||||||
|
|
||||||
for(int i = 0; i < INV_SLOTS; i++) {
|
for(int i = 0; i < INV_SLOTS; i++) {
|
||||||
auto id = $gui.entity("item_", i);
|
auto id = $gui.entity("item_", i);
|
||||||
|
|
|
@ -20,6 +20,7 @@ namespace gui {
|
||||||
void render(sf::RenderWindow& window);
|
void render(sf::RenderWindow& window);
|
||||||
void update_level(GameLevel &level);
|
void update_level(GameLevel &level);
|
||||||
bool mouse(float x, float y, bool hover);
|
bool mouse(float x, float y, bool hover);
|
||||||
|
void make_button(const std::string &name, const std::wstring& label, Events::GUI event);
|
||||||
|
|
||||||
void remove_slot(DinkyECS::Entity slot_id);
|
void remove_slot(DinkyECS::Entity slot_id);
|
||||||
bool place_slot(DinkyECS::Entity gui_id, DinkyECS::Entity world_entity);
|
bool place_slot(DinkyECS::Entity gui_id, DinkyECS::Entity world_entity);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue