|
|
|
@ -1,6 +1,8 @@ |
|
|
|
|
#include "combat_ui.hpp" |
|
|
|
|
#include "constants.hpp" |
|
|
|
|
#include "color.hpp" |
|
|
|
|
#include "rituals.hpp" |
|
|
|
|
#include <fmt/xchar.h> |
|
|
|
|
|
|
|
|
|
namespace gui { |
|
|
|
|
using namespace guecs; |
|
|
|
@ -10,7 +12,7 @@ namespace gui { |
|
|
|
|
{ |
|
|
|
|
$gui.position(COMBAT_UI_X, COMBAT_UI_Y, COMBAT_UI_WIDTH, COMBAT_UI_HEIGHT); |
|
|
|
|
$gui.layout( |
|
|
|
|
"[*%(100,150)button_attack | *%(100,150)button_block | *%(100,150)button_evade | *%(100,150)button_heal]"); |
|
|
|
|
"[*%(100,150)button_0 | *%(100,150)button_1 | *%(100,150)button_2 | *%(100,150)button_3]"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void CombatUI::make_button(std::string name, std::wstring label, Events::GUI event, int action) { |
|
|
|
@ -26,10 +28,16 @@ namespace gui { |
|
|
|
|
|
|
|
|
|
void CombatUI::init() { |
|
|
|
|
$gui.world().set_the<Background>({$gui.$parser, ColorValue::DARK_MID}); |
|
|
|
|
make_button("button_attack", L"Attack", Events::GUI::ATTACK, 1); |
|
|
|
|
make_button("button_block", L"Block", Events::GUI::ATTACK, 2); |
|
|
|
|
make_button("button_evade", L"Evade", Events::GUI::EVADE, 0); |
|
|
|
|
make_button("button_heal", L"Heal", Events::GUI::HEAL, 0); |
|
|
|
|
auto& the_belt = $level.world->get<combat::RitualBelt>($level.player); |
|
|
|
|
|
|
|
|
|
for(int slot = 0; slot < 4; slot++) { |
|
|
|
|
if(the_belt.has(slot)) { |
|
|
|
|
std::string name = fmt::format("button_{}", slot); |
|
|
|
|
std::wstring label = fmt::format(L"Attack {}", slot+1); |
|
|
|
|
make_button(name, label, Events::GUI::ATTACK, slot); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$gui.init(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|