|
|
|
@ -2,6 +2,7 @@ |
|
|
|
|
#include "components.hpp" |
|
|
|
|
#include "color.hpp" |
|
|
|
|
#include "guecs.hpp" |
|
|
|
|
#include "rand.hpp" |
|
|
|
|
|
|
|
|
|
namespace gui { |
|
|
|
|
using namespace guecs; |
|
|
|
@ -23,6 +24,10 @@ namespace gui { |
|
|
|
|
void StatusUI::render(TexturePack &textures) { |
|
|
|
|
auto& world = $gui.world(); |
|
|
|
|
|
|
|
|
|
std::vector<std::string> fake_items{ |
|
|
|
|
"cinqueda", "healing_potion_small", |
|
|
|
|
"torch_crappy", "barrel_small"}; |
|
|
|
|
|
|
|
|
|
for(auto& [name, cell] : $gui.cells()) { |
|
|
|
|
if(name == "log_view") { |
|
|
|
|
$log_to = $gui.entity("log_view"); |
|
|
|
@ -30,10 +35,14 @@ namespace gui { |
|
|
|
|
world.set<Rectangle>($log_to, {}); |
|
|
|
|
world.set<Textual>($log_to, {"Welcome to the Game!", 20}); |
|
|
|
|
} else { |
|
|
|
|
size_t selected_item = Random::uniform<size_t>(0, fake_items.size() - 1); |
|
|
|
|
fmt::println("fake items {} but size {}", selected_item, fake_items.size()); |
|
|
|
|
auto& fake_item = fake_items[selected_item]; |
|
|
|
|
|
|
|
|
|
auto button = $gui.entity(name); |
|
|
|
|
world.set<lel::Cell>(button, cell); |
|
|
|
|
world.set<Rectangle>(button, {}); |
|
|
|
|
world.set<Label>(button, {name}); |
|
|
|
|
world.set<Sprite>(button, {fake_item}); |
|
|
|
|
world.set<Clickable>(button, |
|
|
|
|
guecs::make_action(*$level.world, Events::GUI::NOOP)); |
|
|
|
|
} |
|
|
|
|