From 6447f869541c35961005e7a9759b08d69a5e045f Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Wed, 19 Feb 2025 00:35:32 -0500 Subject: [PATCH] Status UI now fakes a kind of 'hot bar' inventory display. --- status_ui.cpp | 11 ++++++++++- texture.cpp | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/status_ui.cpp b/status_ui.cpp index 27bc94f..0f1d1b0 100644 --- a/status_ui.cpp +++ b/status_ui.cpp @@ -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 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($log_to, {}); world.set($log_to, {"Welcome to the Game!", 20}); } else { + size_t selected_item = Random::uniform(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(button, cell); world.set(button, {}); - world.set