Tinkering with a way to do modal UIs for things like inventory etc.

This commit is contained in:
Zed A. Shaw 2024-12-30 09:41:16 -05:00
parent db441000f8
commit d8400d0a76
9 changed files with 120 additions and 92 deletions

24
gui.hpp
View file

@ -35,6 +35,18 @@ struct ActionLog {
}
};
struct UnDumbTSS {
sf::Texture texture;
sf::Sprite sprite;
sf::Shader shader;
sf::Shader& load_shader(string filename) {
bool good = shader.loadFromFile(filename, sf::Shader::Fragment);
dbc::check(good, "shader could not be loaded");
return shader;
}
};
class GUI {
string $status_text = "NOT DEAD";
@ -43,16 +55,14 @@ class GUI {
ActionLog $log;
Panel $status_ui;
Panel $map_view;
Panel $inventory_ui;
LightRender $lights;
bool $show_modal = false;
Component $test_button;
DinkyECS::World& $world;
SoundManager $sounds;
SFMLRender $renderer;
sf::Texture paused_texture;
sf::Sprite paused_sprite;
sf::Shader paused_shader;
UnDumbTSS $paused;
public:
GUI(DinkyECS::World& world, Map& game_map);
@ -69,7 +79,9 @@ public:
void save_world();
void shake();
void shutdown();
void create_modal();
void draw_modal();
int main(bool run_once=false);
void pause_screen();
void draw_paused();
void init_shaders();
};