Starting a bit of refactoring to sort out how to handle the various UIs.

This commit is contained in:
Zed A. Shaw 2024-12-30 16:33:56 -05:00
parent d8400d0a76
commit f0829bb9ea
3 changed files with 94 additions and 58 deletions

36
gui.hpp
View file

@ -48,14 +48,40 @@ struct UnDumbTSS {
}
};
class GUI {
class InventoryUI : public Panel {
public:
InventoryUI() : Panel(INVENTORY_PIXEL_X, INVENTORY_PIXEL_Y, INVENTORY_WIDTH, INVENTORY_HEIGHT) {}
void create_render();
};
class StatusUI : public Panel {
public:
ActionLog $log;
string $status_text = "NOT DEAD";
DinkyECS::World& $world;
StatusUI(DinkyECS::World& world) :
Panel(0, 0, STATUS_UI_WIDTH, STATUS_UI_HEIGHT),
$log({{"Welcome to the game!"}}),
$world(world) {}
void create_render();
void log(string msg) {
$log.log(msg);
}
};
class MapViewUI : public Panel {
public:
MapViewUI() : Panel(GAME_MAP_PIXEL_POS, 0, 0, 0, true) {}
};
class GUI {
Canvas $canvas;
Map& $game_map;
ActionLog $log;
Panel $status_ui;
Panel $map_view;
Panel $inventory_ui;
StatusUI $status_ui;
MapViewUI $map_view;
InventoryUI $inventory_ui;
LightRender $lights;
bool $show_modal = false;
Component $test_button;