Converted the buttons to reflect the actions you can take.
This commit is contained in:
parent
d7e9944e58
commit
b5d93399d5
4 changed files with 16 additions and 9 deletions
|
@ -1,7 +1,6 @@
|
|||
#include "combat_ui.hpp"
|
||||
#include "constants.hpp"
|
||||
#include "color.hpp"
|
||||
#include "events.hpp"
|
||||
|
||||
namespace gui {
|
||||
using namespace guecs;
|
||||
|
@ -14,21 +13,21 @@ namespace gui {
|
|||
"[*%(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) {
|
||||
void CombatUI::make_button(std::string name, std::wstring label, Events::GUI event) {
|
||||
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));
|
||||
guecs::make_action(*$level.world, event));
|
||||
}
|
||||
|
||||
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");
|
||||
make_button("button_attack", L"Attack", Events::GUI::ATTACK);
|
||||
make_button("button_block", L"Block", Events::GUI::BLOCK);
|
||||
make_button("button_evade", L"Evade", Events::GUI::EVADE);
|
||||
make_button("button_heal", L"Heal", Events::GUI::HEAL);
|
||||
$gui.init();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue