Add the buttons I'll need for the next round of development.

master
Zed A. Shaw 2 days ago
parent dfd3118d04
commit 87459d41bb
  1. 19
      gui/loot_ui.cpp
  2. 1
      gui/loot_ui.hpp

@ -16,21 +16,28 @@ namespace gui {
"[item_4 | item_5 |item_6 | item_7 ]"
"[item_8 | item_9 |item_10| item_11]"
"[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() {
using guecs::THEME;
auto bg_color = THEME.DARK_LIGHT;
bg_color.a = 140;
$gui.set<Background>($gui.MAIN, {$gui.$parser, bg_color});
auto close = $gui.entity("close");
$gui.set<guecs::Rectangle>(close, {});
$gui.set<guecs::Label>(close, {L"CLOSE"});
$gui.set<guecs::Clickable>(close,
guecs::make_action($level, Events::GUI::LOOT_CLOSE));
make_button("close", L"CLOSE", Events::GUI::LOOT_CLOSE);
make_button("take_all", L"TAKE ALL", Events::GUI::LOOT_CLOSE);
make_button("destroy", L"DESTROY", Events::GUI::LOOT_CLOSE);
for(int i = 0; i < INV_SLOTS; i++) {
auto id = $gui.entity("item_", i);

@ -20,6 +20,7 @@ namespace gui {
void render(sf::RenderWindow& window);
void update_level(GameLevel &level);
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);
bool place_slot(DinkyECS::Entity gui_id, DinkyECS::Entity world_entity);

Loading…
Cancel
Save