More refactoring to get the GUI dumber.
This commit is contained in:
parent
2fdbd63f4c
commit
009b1e63a7
6 changed files with 86 additions and 75 deletions
20
gui.hpp
20
gui.hpp
|
@ -36,8 +36,18 @@ enum class Value {
|
|||
LIGHT_LIGHT, WHITE, TRANSPARENT
|
||||
};
|
||||
|
||||
struct ActionLog {
|
||||
std::deque<std::string> messages;
|
||||
|
||||
void log(std::string msg) {
|
||||
messages.push_front(msg);
|
||||
if(messages.size() > 20) {
|
||||
messages.pop_back();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class GUI {
|
||||
Map $game_map;
|
||||
string $status_text = "NOT DEAD";
|
||||
Component $document;
|
||||
Component $map_view;
|
||||
|
@ -48,7 +58,6 @@ class GUI {
|
|||
sf::RenderWindow $window;
|
||||
Screen $screen;
|
||||
Screen $map_screen;
|
||||
DinkyECS::World $world;
|
||||
sf::Texture $font_texture;
|
||||
std::unordered_map<wchar_t, sf::Sprite> $sprites;
|
||||
Point $view_port;
|
||||
|
@ -56,10 +65,12 @@ class GUI {
|
|||
sf::Glyph $base_glyph;
|
||||
float $line_spacing;
|
||||
SoundManager $sounds;
|
||||
Components::ActionLog $log;
|
||||
ActionLog $log;
|
||||
DinkyECS::World& $world;
|
||||
Map& $game_map;
|
||||
|
||||
public:
|
||||
GUI();
|
||||
GUI(DinkyECS::World& world, Map& game_map);
|
||||
// disable copying
|
||||
GUI(GUI &gui) = delete;
|
||||
|
||||
|
@ -71,7 +82,6 @@ public:
|
|||
void handle_world_events();
|
||||
void draw_screen(bool clear=true, float map_off_x=0.0f, float map_off_y=0.0f);
|
||||
void shake();
|
||||
void configure_world();
|
||||
void run_systems();
|
||||
void resize_map(int new_size);
|
||||
sf::Sprite &get_text_sprite(wchar_t tile);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue