From abea6da2e05b8e84fbb9992e517fb4ae01d1eea5 Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Sun, 4 May 2025 23:28:36 -0400 Subject: [PATCH] More GUECS cleanup before releasing. Still need to sort out events and reduce the amount of stuff that GUECS needs. --- color.hpp | 20 ++++++++++---------- combat_ui.cpp | 1 + constants.hpp | 7 ------- guecs.cpp | 24 ++++++------------------ guecs.hpp | 45 ++++++++++++++++++++++++++------------------- guecstra.cpp | 18 ++++++++++++++++++ guecstra.hpp | 7 +++++++ gui_fsm.cpp | 1 + meson.build | 1 + raycaster.cpp | 1 + 10 files changed, 71 insertions(+), 54 deletions(-) create mode 100644 guecstra.cpp create mode 100644 guecstra.hpp diff --git a/color.hpp b/color.hpp index 4026ba5..7815893 100644 --- a/color.hpp +++ b/color.hpp @@ -2,14 +2,14 @@ #include namespace ColorValue { - const sf::Color BLACK{0, 0, 0}; - const sf::Color DARK_DARK{10, 10, 10}; - const sf::Color DARK_MID{30, 30, 30}; - const sf::Color DARK_LIGHT{60, 60, 60}; - const sf::Color MID{100, 100, 100}; - const sf::Color LIGHT_DARK{150, 150, 150}; - const sf::Color LIGHT_MID{200, 200, 200}; - const sf::Color LIGHT_LIGHT{230, 230, 230}; - const sf::Color WHITE{255, 255, 255}; - const sf::Color TRANSPARENT = sf::Color::Transparent; + constexpr const sf::Color BLACK{0, 0, 0}; + constexpr const sf::Color DARK_DARK{10, 10, 10}; + constexpr const sf::Color DARK_MID{30, 30, 30}; + constexpr const sf::Color DARK_LIGHT{60, 60, 60}; + constexpr const sf::Color MID{100, 100, 100}; + constexpr const sf::Color LIGHT_DARK{150, 150, 150}; + constexpr const sf::Color LIGHT_MID{200, 200, 200}; + constexpr const sf::Color LIGHT_LIGHT{230, 230, 230}; + constexpr const sf::Color WHITE{255, 255, 255}; + constexpr const sf::Color TRANSPARENT = sf::Color::Transparent; } diff --git a/combat_ui.cpp b/combat_ui.cpp index a95140f..5e91b75 100644 --- a/combat_ui.cpp +++ b/combat_ui.cpp @@ -3,6 +3,7 @@ #include "color.hpp" #include "rituals.hpp" #include +#include "guecstra.hpp" namespace gui { using namespace guecs; diff --git a/constants.hpp b/constants.hpp index 7bfa1e1..bc162f4 100644 --- a/constants.hpp +++ b/constants.hpp @@ -24,13 +24,6 @@ constexpr const int FRAME_LIMIT=60; constexpr const int NUM_SPRITES=1; constexpr const int MAX_LOG_MESSAGES=17; -constexpr const int GUECS_PADDING = 3; -constexpr const int GUECS_BORDER_PX = 1; -constexpr const int GUECS_FONT_SIZE = 30; -const sf::Color GUECS_FILL_COLOR = ColorValue::DARK_MID; -const sf::Color GUECS_TEXT_COLOR = ColorValue::LIGHT_LIGHT; -const sf::Color GUECS_BG_COLOR = ColorValue::MID; -const sf::Color GUECS_BORDER_COLOR = ColorValue::MID; #ifdef NDEBUG constexpr const bool DEBUG_BUILD=false; diff --git a/guecs.cpp b/guecs.cpp index feec9f2..dd23518 100644 --- a/guecs.cpp +++ b/guecs.cpp @@ -1,8 +1,11 @@ #include "guecs.hpp" #include "shaders.hpp" #include "sound.hpp" +#include "textures.hpp" +#include namespace guecs { + using std::make_shared; void Textual::init(lel::Cell &cell, shared_ptr font_ptr) { dbc::check(font_ptr != nullptr, "you failed to initialize this WideText"); @@ -314,7 +317,7 @@ namespace guecs { tc->text->setString(content); } else { auto &cell = cell_for(ent); - Textual to_set{content, 20}; + Textual to_set{content, TEXT_SIZE}; to_set.init(cell, $font); set(ent, to_set); } @@ -348,25 +351,10 @@ namespace guecs { tc->text->setString(content); } else { auto &cell = cell_for(ent); - Label to_set{content, 20}; + Label to_set{content, LABEL_SIZE}; to_set.init(cell, $font); - to_set.text->setFillColor(ColorValue::LIGHT_MID); + to_set.text->setFillColor(TEXT_COLOR); set