Change the buttons to text for development until I can get the icons/art.

master
Zed A. Shaw 7 days ago
parent e11a374d26
commit d7e9944e58
  1. 29
      combat_ui.cpp
  2. 1
      combat_ui.hpp

@ -11,23 +11,24 @@ namespace gui {
{
$gui.position(COMBAT_UI_X, COMBAT_UI_Y, COMBAT_UI_WIDTH, COMBAT_UI_HEIGHT);
$gui.layout(
"[*%(100,150)button_attack1 | *%(100,150)button_attack2 | *%(100,150)button_attack3 | *%(100,150)button_heal]");
"[*%(100,150)button_attack | *%(100,150)button_block | *%(100,150)button_evade | *%(100,150)button_heal]");
}
void CombatUI::init() {
auto& world = $gui.world();
world.set_the<Background>({$gui.$parser, ColorValue::DARK_MID});
for(auto& [name, cell] : $gui.cells()) {
if(name.starts_with("button_")) {
auto button = $gui.entity(name);
world.set<Sprite>(button, {"leather_pouch-128"});
world.set<Clickable>(button,
guecs::make_action(*$level.world, Events::GUI::ATTACK));
}
}
void CombatUI::make_button(std::string name, std::wstring label) {
auto button = $gui.entity(name);
// $gui.set<Sprite>(button, {"leather_pouch-128"});
$gui.set<Rectangle>(button, {});
$gui.set<Label>(button, {label});
$gui.set<Clickable>(button,
guecs::make_action(*$level.world, Events::GUI::ATTACK));
}
void CombatUI::init() {
$gui.world().set_the<Background>({$gui.$parser, ColorValue::DARK_MID});
make_button("button_attack", L"Attack");
make_button("button_block", L"Block");
make_button("button_evade", L"Evade");
make_button("button_heal", L"Heal");
$gui.init();
}

@ -17,5 +17,6 @@ namespace gui {
void update_level(GameLevel &level);
void set_damage(float percent);
bool mouse(float x, float y);
void make_button(std::string name, std::wstring label);
};
}

Loading…
Cancel
Save