Change the buttons to text for development until I can get the icons/art.
This commit is contained in:
parent
e11a374d26
commit
d7e9944e58
2 changed files with 16 additions and 14 deletions
|
@ -11,23 +11,24 @@ namespace gui {
|
||||||
{
|
{
|
||||||
$gui.position(COMBAT_UI_X, COMBAT_UI_Y, COMBAT_UI_WIDTH, COMBAT_UI_HEIGHT);
|
$gui.position(COMBAT_UI_X, COMBAT_UI_Y, COMBAT_UI_WIDTH, COMBAT_UI_HEIGHT);
|
||||||
$gui.layout(
|
$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::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() {
|
void CombatUI::init() {
|
||||||
auto& world = $gui.world();
|
$gui.world().set_the<Background>({$gui.$parser, ColorValue::DARK_MID});
|
||||||
|
make_button("button_attack", L"Attack");
|
||||||
world.set_the<Background>({$gui.$parser, ColorValue::DARK_MID});
|
make_button("button_block", L"Block");
|
||||||
|
make_button("button_evade", L"Evade");
|
||||||
for(auto& [name, cell] : $gui.cells()) {
|
make_button("button_heal", L"Heal");
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$gui.init();
|
$gui.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,5 +17,6 @@ namespace gui {
|
||||||
void update_level(GameLevel &level);
|
void update_level(GameLevel &level);
|
||||||
void set_damage(float percent);
|
void set_damage(float percent);
|
||||||
bool mouse(float x, float y);
|
bool mouse(float x, float y);
|
||||||
|
void make_button(std::string name, std::wstring label);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue