|
|
|
@ -9,22 +9,31 @@ namespace gui { |
|
|
|
|
$gui.position(RAY_VIEW_X, RAY_VIEW_HEIGHT, RAY_VIEW_WIDTH, SCREEN_HEIGHT - RAY_VIEW_HEIGHT); |
|
|
|
|
$gui.layout( |
|
|
|
|
"[*%(100,150)button_attack1 | *%(100,150)button_attack2 | *%(100,150)button_attack3 | *%(100,150)button_heal]" |
|
|
|
|
"[ >.%(100,50)label_hp | *%.(200,50)bar_hp | _ ]"); |
|
|
|
|
render(); |
|
|
|
|
"[ >.%(100,50)label_hp | *%.(100,50)bar_hp | _ ]"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void CombatUI::render() { |
|
|
|
|
void CombatUI::render(TexturePack& textures) { |
|
|
|
|
auto& world = $gui.world(); |
|
|
|
|
|
|
|
|
|
for(auto& [name, cell] : $gui.cells()) { |
|
|
|
|
auto button = $gui.entity(name); |
|
|
|
|
world.set<lel::Cell>(button, cell); |
|
|
|
|
world.set<Rectangle>(button, {}); |
|
|
|
|
world.set<Clickable>(button, {100}); |
|
|
|
|
world.set<Textual>(button, {name}); |
|
|
|
|
if(name.starts_with("button_")) { |
|
|
|
|
auto button = $gui.entity(name); |
|
|
|
|
world.set<lel::Cell>(button, cell); |
|
|
|
|
world.set<Sprite>(button, {"trash_button"}); |
|
|
|
|
world.set<Clickable>(button, {100}); |
|
|
|
|
world.set<Textual>(button, {name}); |
|
|
|
|
} else if(name.starts_with("bar_")) { |
|
|
|
|
auto meter = $gui.entity(name); |
|
|
|
|
world.set<lel::Cell>(meter, cell); |
|
|
|
|
world.set<Rectangle>(meter, {}); |
|
|
|
|
world.set<Meter>(meter, {}); |
|
|
|
|
} else { |
|
|
|
|
// ignored, it's just space
|
|
|
|
|
$gui.entity(name); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$gui.init(); |
|
|
|
|
$gui.init(textures); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void CombatUI::draw(sf::RenderWindow& window) { |
|
|
|
|