Started the overlay UI but need to make it possible to add/remove components to it.

This commit is contained in:
Zed A. Shaw 2025-02-20 02:33:09 -05:00
parent 59d10a4506
commit 70a9420c11
8 changed files with 91 additions and 43 deletions

27
overlay_ui.hpp Normal file
View file

@ -0,0 +1,27 @@
#pragma once
#include "levelmanager.hpp"
#include <SFML/Graphics/RenderWindow.hpp>
#include <SFML/Graphics/Font.hpp>
#include "guecs.hpp"
namespace gui {
class OverlayUI {
public:
guecs::UI $gui;
GameLevel $level;
std::unordered_map<std::string, DinkyECS::Entity> $name_ents;
OverlayUI(GameLevel level);
void render(TexturePack& texture);
void draw(sf::RenderWindow& window);
void click(int x, int y);
template <typename Comp>
// this should be in the GUECS really
void set(std::string name, Comp val) {
auto ent = $name_ents.at(name);
$level.world->set<Comp>(ent, val);
}
};
}