sdl_runtime_compiler git · main
SDL3 game for running and compiling code at runtime
C++ 72.3% C 26.2%git clone https://git.christianimmanuel.de/sdl-graphics/sdl_runtime_compiler.gitwget https://git.christianimmanuel.de/sdl-graphics/sdl_runtime_compiler/archive/sdl_runtime_compiler.tar.gzRename ConfigColor[s] AND remove color_ prefix
src/c_token/token_color.hpp | 18 ++++---- src/entities/pult.cpp | 2 +- src/levels/scene.hpp | 2 +- src/states/game_state.cpp | 26 +++++------ src/systems/celebration_system.cpp | 2 +- src/systems/compiler_system.cpp | 2 +- src/systems/hint_system.cpp | 2 +- src/systems/mod_loader_system.cpp | 2 +- src/systems/program_system.cpp | 6 +-- src/systems/projectile_system.cpp | 2 +- src/systems/word_ai_system.cpp | 16 +++---- src/systems/word_anim.cpp | 2 +- src/text_3d/text_3d.hpp | 2 +- src/utils/config.hpp | 94 +++++++++++++++++++------------------- src/wall/editor_wall.cpp | 6 +-- src/wall/text_wall.cpp | 2 +- src/wall/text_wall_scroll.hpp | 2 +- src/wall/wall_label.cpp | 10 ++-- src/wall/wall_surfaces.cpp | 15 ++---- 19 files changed, 103 insertions(+), 110 deletions(-) diff --git a/src/c_token/token_color.hpp b/src/c_token/token_color.hpp index 5606a7c..70594f6 100644 --- a/src/c_token/token_color.hpp +++ b/src/c_token/token_color.hpp @@ -10,15 +10,15 @@ inline SDL_FColor get(TokenType t) { switch (t) { - case TokenType::Keyword: return ConfigColors::color_orange; // if, for, return - case TokenType::Type: return ConfigColors::color_green; // int, void - case TokenType::Identifier: return ConfigColors::color_light_gray; // main, printf, i, x … - case TokenType::Literal: return ConfigColors::color_red; // 0, 1, "\n", %s - case TokenType::Operator: return ConfigColors::color_light_gray; // = == + - * / ++ - case TokenType::Delimiter: return ConfigColors::color_light_gray; // ( ) { } ; , [ ] - case TokenType::Preprocessor:return ConfigColors::color_pink; // #define #if + case TokenType::Keyword: return ConfigColor::orange; // if, for, return + case TokenType::Type: return ConfigColor::green; // int, void + case TokenType::Identifier: return ConfigColor::light_gray; // main, printf, i, x … + case TokenType::Literal: return ConfigColor::red; // 0, 1, "\n", %s + case TokenType::Operator: return ConfigColor::light_gray; // = == + - * / ++ + case TokenType::Delimiter: return ConfigColor::light_gray; // ( ) { } ; , [ ] + case TokenType::Preprocessor:return ConfigColor::pink; // #define #if } - return ConfigColors::color_white; + return ConfigColor::white; } inline void @@ -33,7 +33,7 @@ inline SDL_FColor get_ByString(std::string token_text) { const Token* tok = TokenDB::find_OrSynthesize(token_text); - return tok ? get(tok->type) : ConfigColors::color_white; + return tok ? get(tok->type) : ConfigColor::white; } } diff --git a/src/entities/pult.cpp b/src/entities/pult.cpp index a785c72..03444c6 100644 --- a/src/entities/pult.cpp +++ b/src/entities/pult.cpp @@ -67,7 +67,7 @@ Pult::Pult(const std::string& n, Vec3 world_pos, , name(n), half_w(half_width), half_d(half_depth) { label.set_Billboard(true); - label.set_Style(ConfigColors::color_teal, Text3d::depth_wall, 0.0025f); + label.set_Style(ConfigColor::teal, Text3d::depth_wall, 0.0025f); label.set_Collidable(true); label.attach_To(&pos, Vec3{ 0.0, ConfigPult::label_height, 0.0 }); label.set_Text(n); diff --git a/src/levels/scene.hpp b/src/levels/scene.hpp index 5794eca..531da62 100644 --- a/src/levels/scene.hpp +++ b/src/levels/scene.hpp @@ -14,7 +14,7 @@ struct PlacedWord { std::string text; Vec3 pos; - SDL_FColor color = ConfigColors::color_floor; + SDL_FColor color = ConfigColor::floor; bool required = false; }; diff --git a/src/states/game_state.cpp b/src/states/game_state.cpp index 6562fb2..a49ac11 100644 --- a/src/states/game_state.cpp +++ b/src/states/game_state.cpp @@ -232,7 +232,7 @@ GameState::on_Pick() if (base->type == ObjectType::Text) { _step_ledger.picked_up.push_back(base->text); - base->set_Look(ConfigColors::color_keep, Text3d::depth_floor); + base->set_Look(ConfigColor::keep, Text3d::depth_floor); TextWall::show_TokenInfo(_ctx.wall_texts, base->text, _ctx.world->scale()); } carry_BeginAnim(std::move(base), /*with_pitch=*/true); @@ -246,7 +246,7 @@ GameState::on_Pick() if (!word) return false; _step_ledger.picked_up.push_back(word->text); - word->set_Look(ConfigColors::color_keep, Text3d::depth_floor); + word->set_Look(ConfigColor::keep, Text3d::depth_floor); TextWall::show_TokenInfo(_ctx.wall_texts, word->text, _ctx.world->scale()); carry_BeginAnim(std::move(word), /*with_pitch=*/false); @@ -500,7 +500,7 @@ GameState::projectile_LandOnFloor(ProjectileResult& result) { for (Text3dPtr& w : result.words) { if (!w || w->type != ObjectType::Text) continue; - w->set_Look(ConfigColors::color_keep, Text3d::depth_floor); + w->set_Look(ConfigColor::keep, Text3d::depth_floor); w->body.mode = PhysicsMode::Dynamic; w->body.vel = result.vel; _ctx.words.push_back(std::move(w)); @@ -518,7 +518,7 @@ GameState::projectile_LandOnWall(ProjectileResult& result) for (Text3dPtr& w : result.words) { if (!w) continue; if (w->type == ObjectType::Text) - w->set_Look(ConfigColors::color_keep, Text3d::depth_wall); + w->set_Look(ConfigColor::keep, Text3d::depth_wall); w->body.mode = PhysicsMode::Static; w->body.vel = Vec3{0, 0, 0}; @@ -580,7 +580,7 @@ GameState::walltext_HandleShootDown(ProjectileResult& result, orphan->body.vel = { 0.0, 1.5, 0.0 }; orphan->body.hover_height = -static_cast<double>(_ctx.world->scale()) + 1.5; orphan->yaw = 0.0f; - orphan->set_Look(ConfigColors::color_keep, Text3d::depth_floor); + orphan->set_Look(ConfigColor::keep, Text3d::depth_floor); _ctx.words.push_back(std::move(orphan)); to_erase.push_back(result.wall_text_index); } @@ -589,7 +589,7 @@ GameState::walltext_HandleShootDown(ProjectileResult& result, for (Text3dPtr& w : result.words) { if (!w) continue; if (w->type == ObjectType::Text) { - w->set_Look(ConfigColors::color_keep, Text3d::depth_floor); + w->set_Look(ConfigColor::keep, Text3d::depth_floor); } w->body.mode = PhysicsMode::Dynamic; w->body.vel = result.vel; @@ -867,7 +867,7 @@ GameState::infowall_StepdetailsShow() if (line.empty()) continue; Text3dPtr t = make_Text3d(line, Text3d::depth_wall, 0.0025f, - pos, ConfigColors::color_white); + pos, ConfigColor::white); t->yaw = wall_transform.yaw; _ctx.wall_texts.push_back(cpputils::make_unique<TextWall>( @@ -904,7 +904,7 @@ GameState::scene_Setup(const Scene& scene) for (const PlacedAi& a : scene.ai_seeds) { Text3dPtr t = make_Text3d(a.text, Text3d::depth_floor, 0.003f, - a.pos, ConfigColors::color_floor); + a.pos, ConfigColor::floor); t->body.hover_height = a.pos.y; t->ai.aggressiveness = a.aggressiveness; @@ -912,14 +912,14 @@ GameState::scene_Setup(const Scene& scene) case Text3dAI::State::Attack: t->ai.state = Text3dAI::State::Attack; t->body.mode = PhysicsMode::AiHover; - t->set_Color(ConfigColors::color_attack); + t->set_Color(ConfigColor::attack); t->ai.state_timer = 0.0; t->ai.phase_timer = 0.5; break; case Text3dAI::State::Flee: t->ai.state = Text3dAI::State::Flee; t->body.mode = PhysicsMode::AiHover; - t->set_Color(ConfigColors::color_flee); + t->set_Color(ConfigColor::flee); break; case Text3dAI::State::Idle: case Text3dAI::State::Stunned: @@ -1082,7 +1082,7 @@ GameState::substep(double dt) word->ai.state = Text3dAI::State::Stunned; word->ai.state_timer = 0.0; word->body.vel = Vec3{0, 0, 0}; - word->set_Color(ConfigColors::color_stunned); + word->set_Color(ConfigColor::stunned); } } } @@ -1268,7 +1268,7 @@ GameState::sandbox_LoadFileToWall() double z = z_start; for (const std::string& tk : toks) { Text3dPtr t = make_Text3d(tk, Text3d::depth_wall, 0.003f, - Vec3{ x_wall, y, z }, ConfigColors::color_wall); + Vec3{ x_wall, y, z }, ConfigColor::wall); t->yaw = tf.yaw; // Snap into the editor wall's line tracking, like a thrown word. @@ -1306,7 +1306,7 @@ GameState::typing_RebuildPreview(const std::string& s) std::string tok; while (in >> tok) { Text3dPtr t = make_Text3d(tok, Text3d::depth_floor, 0.003f, - anchor, ConfigColors::color_floor); + anchor, ConfigColor::floor); t->yaw = static_cast<float>(glyph_yaw); t->body.mode = PhysicsMode::Carried; _typing_words.push_back(t.get()); // track raw ptr for later removal diff --git a/src/systems/celebration_system.cpp b/src/systems/celebration_system.cpp index 88aab08..75ed8f7 100644 --- a/src/systems/celebration_system.cpp +++ b/src/systems/celebration_system.cpp @@ -21,7 +21,7 @@ CelebrationSystem::start(const Camera& cam, double& glyph_yaw) _banner = make_Text3d("Success", Text3d::depth_floor * 2.0f, 0.012f, banner_pos, - ConfigColors::color_white); + ConfigColor::white); _banner->yaw = static_cast<float>(glyph_yaw); _banner->body.mode = PhysicsMode::Static; } diff --git a/src/systems/compiler_system.cpp b/src/systems/compiler_system.cpp index b49865d..3fbea6e 100644 --- a/src/systems/compiler_system.cpp +++ b/src/systems/compiler_system.cpp @@ -84,7 +84,7 @@ CompilerSystem::push_Line(TextWallList& texts, const std::string& line, float wo Vec3 pos = tf.position; pos.y = start_y; - Text3dPtr t = make_Text3d(clean, Text3d::depth_compiler, 0.003f, pos, ConfigColors::color_compiler); + Text3dPtr t = make_Text3d(clean, Text3d::depth_compiler, 0.003f, pos, ConfigColor::compiler); t->yaw = tf.yaw; TextWallPtr wt = cpputils::make_unique<TextWall>(TextWall{ diff --git a/src/systems/hint_system.cpp b/src/systems/hint_system.cpp index cd57906..798ff02 100644 --- a/src/systems/hint_system.cpp +++ b/src/systems/hint_system.cpp @@ -5,7 +5,7 @@ HintSystem::HintSystem() { _label.set_Centre(Vec3{ 0.0, static_cast<double>(-ConfigGame::world_box_scale) + 2.5, 0.0 }); _label.set_Billboard(true); - _label.set_Style(ConfigColors::color_yellow, Text3d::depth_wall, 0.003f); + _label.set_Style(ConfigColor::yellow, Text3d::depth_wall, 0.003f); _label.set_Collidable(true); } diff --git a/src/systems/mod_loader_system.cpp b/src/systems/mod_loader_system.cpp index 872302c..fcf7468 100644 --- a/src/systems/mod_loader_system.cpp +++ b/src/systems/mod_loader_system.cpp @@ -154,7 +154,7 @@ ModLoader::push_Line(TextWallList& texts, const std::string& line, float world_s std::string clean = ascii_Sanitize(line); Text3dPtr t = make_Text3d(clean, Text3d::depth_compiler, 0.003f, - pos, ConfigColors::color_compiler); + pos, ConfigColor::compiler); t->yaw = tf.yaw; texts.push_back(cpputils::make_unique<TextWall>(TextWall{ diff --git a/src/systems/program_system.cpp b/src/systems/program_system.cpp index 80849b5..8b9f8f3 100644 --- a/src/systems/program_system.cpp +++ b/src/systems/program_system.cpp @@ -181,10 +181,10 @@ ProgramSystem::echo_Words(TextWallList& texts, DynArray<Text3dPtr>& words, float // wall text (dark, like output) and snap their row onto start_y. for (Text3dPtr& w : words) { if (!w) continue; - w->set_Color(ConfigColors::color_dark_gray); + w->set_Color(ConfigColor::dark_gray); w->yaw = tf.yaw; w->pos.y = start_y; // align the echoed row to the line - w->set_Look(ConfigColors::color_keep, Text3d::depth_wall); + w->set_Look(ConfigColor::keep, Text3d::depth_wall); texts.push_back(cpputils::make_unique<TextWall>(TextWall{ Wall::position_of(Wall::Role::Program), @@ -212,7 +212,7 @@ ProgramSystem::push_Line(TextWallList& texts, const std::string& line, float wor // Program wall is light ivory → use a dark text colour for contrast. Text3dPtr t = make_Text3d(clean, Text3d::depth_wall, 0.003f, - pos, ConfigColors::color_dark_gray); + pos, ConfigColor::dark_gray); t->yaw = tf.yaw; texts.push_back(cpputils::make_unique<TextWall>(TextWall{ diff --git a/src/systems/projectile_system.cpp b/src/systems/projectile_system.cpp index 44fbc78..55d91e3 100644 --- a/src/systems/projectile_system.cpp +++ b/src/systems/projectile_system.cpp @@ -399,7 +399,7 @@ ProjectileSystem::launch(DynArray<Projectile>& out, for (Text3dPtr& w : words) { if (!w) continue; if (w->type == ObjectType::Text) - w->set_Look(ConfigColors::color_keep, Text3d::depth_floor); + w->set_Look(ConfigColor::keep, Text3d::depth_floor); w->yaw = static_cast<float>(yaw); } diff --git a/src/systems/word_ai_system.cpp b/src/systems/word_ai_system.cpp index 23a0b79..a536539 100644 --- a/src/systems/word_ai_system.cpp +++ b/src/systems/word_ai_system.cpp @@ -57,12 +57,12 @@ WordAiSystem::update(DynArray<Text3dPtr>& words, if (!s) continue; s->body.mode = PhysicsMode::Dynamic; s->body.vel = w->body.vel * 0.5; - s->set_Color(s->token_info ? TokenColor::get(s->token_info->type) : ConfigColors::color_floor); + s->set_Color(s->token_info ? TokenColor::get(s->token_info->type) : ConfigColor::floor); released.push_back(std::move(s)); // deferred — not words.push_back } w->ai.stolen.clear(); w->ai.state = Text3dAI::State::Idle; - w->set_Color(w->token_info ? TokenColor::get(w->token_info->type) : ConfigColors::color_floor); + w->set_Color(w->token_info ? TokenColor::get(w->token_info->type) : ConfigColor::floor); continue; } @@ -174,7 +174,7 @@ void WordAiSystem::update_Attack(Text3d& w, const Player& p, CarriedLine& carrie if (random_unit() < ConfigAi::steal_probability) { Text3dPtr stolen = std::move(node->word); stolen->body.mode = PhysicsMode::AiHover; - stolen->set_Color(ConfigColors::color_attack); + stolen->set_Color(ConfigColor::attack); w.ai.stolen.push_back(std::move(stolen)); enter_Flee(w); // run away with the loot carried.compact(); @@ -290,7 +290,7 @@ WordAiSystem::release_StolenWords(Text3d& w, DynArray<Text3dPtr>& out) if (!s) continue; s->body.mode = PhysicsMode::Dynamic; s->body.vel = { w.body.vel.x * 0.5, 2.0, w.body.vel.z * 0.5 }; - s->set_Color(s->token_info ? TokenColor::get(s->token_info->type) : ConfigColors::color_floor); + s->set_Color(s->token_info ? TokenColor::get(s->token_info->type) : ConfigColor::floor); out.push_back(std::move(s)); } w.ai.stolen.clear(); @@ -307,7 +307,7 @@ WordAiSystem::enter_Attack(Text3d& w) w.ai.has_stolen = false; w.ai.hover_height_saved = w.body.hover_height; w.body.mode = PhysicsMode::AiHover; - w.set_Color(ConfigColors::color_attack); + w.set_Color(ConfigColor::attack); // Pick an orbit direction and starting angle for the no-carry wander. w.ai.orbit_angle = random_unit() * SDL_PI_D * 2.0; @@ -324,7 +324,7 @@ WordAiSystem::enter_Flee(Text3d& w) w.ai.in_pause = false; w.ai.hover_height_saved = w.body.hover_height; w.body.mode = PhysicsMode::AiHover; - w.set_Color(ConfigColors::color_flee); + w.set_Color(ConfigColor::flee); } @@ -334,7 +334,7 @@ WordAiSystem::enter_Stunned(Text3d& w) w.ai.state = Text3dAI::State::Stunned; w.ai.state_timer = 0.0; w.body.vel = Vec3{}; - w.set_Color(ConfigColors::color_stunned); + w.set_Color(ConfigColor::stunned); } @@ -345,7 +345,7 @@ WordAiSystem::enter_Idle(Text3d& w) w.ai.state_timer = 0.0; w.body.mode = PhysicsMode::Hover; w.body.hover_height = w.ai.hover_height_saved; - w.set_Color(w.token_info ? TokenColor::get(w.token_info->type) : ConfigColors::color_floor); + w.set_Color(w.token_info ? TokenColor::get(w.token_info->type) : ConfigColor::floor); } diff --git a/src/systems/word_anim.cpp b/src/systems/word_anim.cpp index 7257298..a58d0d2 100644 --- a/src/systems/word_anim.cpp +++ b/src/systems/word_anim.cpp @@ -70,7 +70,7 @@ WordAnimSystem::update(DynArray<WordAnim_Add>& anims_add, drop.word->body.vel.y = 0.0; drop.word->body.mode = PhysicsMode::Dynamic; if (drop.word->type == ObjectType::Text) - drop.word->set_Look(ConfigColors::color_keep, Text3d::depth_floor); + drop.word->set_Look(ConfigColor::keep, Text3d::depth_floor); words.push_back(std::move(drop.word)); } } diff --git a/src/text_3d/text_3d.hpp b/src/text_3d/text_3d.hpp index d409049..d6492a1 100644 --- a/src/text_3d/text_3d.hpp +++ b/src/text_3d/text_3d.hpp @@ -95,7 +95,7 @@ struct Text3d final : public GameObject { Text3d(const std::string& txt, float depth, float scale, Vec3 position, - SDL_FColor colr = ConfigColors::color_blue); + SDL_FColor colr = ConfigColor::blue); ~Text3d() override; Vec3 get_Distance(Vec3 position); diff --git a/src/utils/config.hpp b/src/utils/config.hpp index ee5b331..a33cb0d 100644 --- a/src/utils/config.hpp +++ b/src/utils/config.hpp @@ -27,54 +27,54 @@ static constexpr double proj_t_max = 1.2; // clamp: farthest throws } -namespace ConfigColors +namespace ConfigColor { - static inline constexpr SDL_FColor color_keep = {0.0f, -1.0f, 0.0f, 1.0f}; - static inline constexpr SDL_FColor color_attack = {1.0f, 0.35f, 0.2f, 1.0f}; - static inline constexpr SDL_FColor color_flee = {1.0f, 0.95f, 0.4f, 1.0f}; - static inline constexpr SDL_FColor color_stunned = {0.45f, 0.45f, 0.5f, 1.0f}; - - static inline constexpr SDL_FColor color_white = {1.0f, 1.0f, 1.0f, 1.0f}; - static inline constexpr SDL_FColor color_red = {1.0f, 0.0f, 0.0f, 1.0f}; - static inline constexpr SDL_FColor color_green = {0.30f, 0.70f, 0.40f, 1.0f}; - static inline constexpr SDL_FColor color_blue = {0.0f, 0.86f, 1.0f, 1.0f}; - static inline constexpr SDL_FColor color_yellow = {1.0f, 1.0f, 0.0f, 1.0f}; - static inline constexpr SDL_FColor color_cyan = {0.0f, 1.0f, 1.0f, 1.0f}; - static inline constexpr SDL_FColor color_magenta = {1.0f, 0.0f, 1.0f, 1.0f}; - static inline constexpr SDL_FColor color_black = {0.0f, 0.0f, 0.0f, 1.0f}; - static inline constexpr SDL_FColor color_gray = {0.5f, 0.5f, 0.5f, 1.0f}; - static inline constexpr SDL_FColor color_soft_blue = {0.55f, 0.72f, 0.92f, 1.0f}; - static inline constexpr SDL_FColor color_slate_blue = {0.42f, 0.52f, 0.63f, 1.0f}; - static inline constexpr SDL_FColor color_orange = {1.0f, 0.55f, 0.10f, 1.0f}; - static inline constexpr SDL_FColor color_amber = {1.0f, 0.75f, 0.20f, 1.0f}; - static inline constexpr SDL_FColor color_lime = {0.65f, 0.95f, 0.25f, 1.0f}; - static inline constexpr SDL_FColor color_teal = {0.0f, 0.65f, 0.60f, 1.0f}; - static inline constexpr SDL_FColor color_sky = {0.40f, 0.70f, 1.0f, 1.0f}; - static inline constexpr SDL_FColor color_pale_sky = {0.80f, 0.90f, 1.00f, 1.0f}; - static inline constexpr SDL_FColor color_indigo = {0.30f, 0.30f, 0.80f, 1.0f}; - static inline constexpr SDL_FColor color_deep_indigo = {0.06f, 0.05f, 0.12f, 1.0f}; - static inline constexpr SDL_FColor color_light_indigo= {0.70f, 0.65f, 1.00f, 1.0f}; - static inline constexpr SDL_FColor color_warm_ivory = {0.95f, 0.92f, 0.82f, 1.0f}; - static inline constexpr SDL_FColor color_purple = {0.60f, 0.30f, 0.85f, 1.0f}; - static inline constexpr SDL_FColor color_pink = {1.0f, 0.34f, 0.87f, 1.0f}; - static inline constexpr SDL_FColor color_brown = {0.55f, 0.35f, 0.20f, 1.0f}; - static inline constexpr SDL_FColor color_dark_gray = {0.25f, 0.25f, 0.25f, 1.0f}; - static inline constexpr SDL_FColor color_light_gray = {0.82f, 0.82f, 0.82f, 1.0f}; - static inline constexpr SDL_FColor color_cream_paper = {0.066f, 0.113f, 0.18f, 1.0f}; - static inline constexpr SDL_FColor color_bronze_ink = {0.48f, 0.36f, 0.16f, 1.0f}; - - - static inline constexpr SDL_FColor color_floor = color_blue; - static inline constexpr SDL_FColor color_wall = color_green; - - static inline constexpr SDL_FColor color_compiler = color_deep_indigo; - static inline constexpr SDL_FColor color_compiler_label = color_light_indigo; - static inline constexpr SDL_FColor color_info = color_slate_blue; - static inline constexpr SDL_FColor color_info_label = color_pale_sky; - static inline constexpr SDL_FColor color_program = color_warm_ivory; - static inline constexpr SDL_FColor color_program_label = color_bronze_ink; - static inline constexpr SDL_FColor color_editor = color_cream_paper; - static inline constexpr SDL_FColor color_editor_label = color_soft_blue; + static inline constexpr SDL_FColor keep = {0.0f, -1.0f, 0.0f, 1.0f}; + static inline constexpr SDL_FColor attack = {1.0f, 0.35f, 0.2f, 1.0f}; + static inline constexpr SDL_FColor flee = {1.0f, 0.95f, 0.4f, 1.0f}; + static inline constexpr SDL_FColor stunned = {0.45f, 0.45f, 0.5f, 1.0f}; + + static inline constexpr SDL_FColor white = {1.0f, 1.0f, 1.0f, 1.0f}; + static inline constexpr SDL_FColor red = {1.0f, 0.0f, 0.0f, 1.0f}; + static inline constexpr SDL_FColor green = {0.30f, 0.70f, 0.40f, 1.0f}; + static inline constexpr SDL_FColor blue = {0.0f, 0.86f, 1.0f, 1.0f}; + static inline constexpr SDL_FColor yellow = {1.0f, 1.0f, 0.0f, 1.0f}; + static inline constexpr SDL_FColor cyan = {0.0f, 1.0f, 1.0f, 1.0f}; + static inline constexpr SDL_FColor magenta = {1.0f, 0.0f, 1.0f, 1.0f}; + static inline constexpr SDL_FColor black = {0.0f, 0.0f, 0.0f, 1.0f}; + static inline constexpr SDL_FColor gray = {0.5f, 0.5f, 0.5f, 1.0f}; + static inline constexpr SDL_FColor soft_blue = {0.55f, 0.72f, 0.92f, 1.0f}; + static inline constexpr SDL_FColor slate_blue = {0.42f, 0.52f, 0.63f, 1.0f}; + static inline constexpr SDL_FColor orange = {1.0f, 0.55f, 0.10f, 1.0f}; + static inline constexpr SDL_FColor amber = {1.0f, 0.75f, 0.20f, 1.0f}; + static inline constexpr SDL_FColor lime = {0.65f, 0.95f, 0.25f, 1.0f}; + static inline constexpr SDL_FColor teal = {0.0f, 0.65f, 0.60f, 1.0f}; + static inline constexpr SDL_FColor sky = {0.40f, 0.70f, 1.0f, 1.0f}; + static inline constexpr SDL_FColor pale_sky = {0.80f, 0.90f, 1.00f, 1.0f}; + static inline constexpr SDL_FColor indigo = {0.30f, 0.30f, 0.80f, 1.0f}; + static inline constexpr SDL_FColor deep_indigo = {0.06f, 0.05f, 0.12f, 1.0f}; + static inline constexpr SDL_FColor light_indigo= {0.70f, 0.65f, 1.00f, 1.0f}; + static inline constexpr SDL_FColor warm_ivory = {0.95f, 0.92f, 0.82f, 1.0f}; + static inline constexpr SDL_FColor purple = {0.60f, 0.30f, 0.85f, 1.0f}; + static inline constexpr SDL_FColor pink = {1.0f, 0.34f, 0.87f, 1.0f}; + static inline constexpr SDL_FColor brown = {0.55f, 0.35f, 0.20f, 1.0f}; + static inline constexpr SDL_FColor dark_gray = {0.25f, 0.25f, 0.25f, 1.0f}; + static inline constexpr SDL_FColor light_gray = {0.82f, 0.82f, 0.82f, 1.0f}; + static inline constexpr SDL_FColor cream_paper = {0.066f, 0.113f, 0.18f, 1.0f}; + static inline constexpr SDL_FColor bronze_ink = {0.48f, 0.36f, 0.16f, 1.0f}; + + + static inline constexpr SDL_FColor floor = blue; + static inline constexpr SDL_FColor wall = green; + + static inline constexpr SDL_FColor compiler = deep_indigo; + static inline constexpr SDL_FColor compiler_label = light_indigo; + static inline constexpr SDL_FColor info = slate_blue; + static inline constexpr SDL_FColor info_label = pale_sky; + static inline constexpr SDL_FColor program = warm_ivory; + static inline constexpr SDL_FColor program_label = bronze_ink; + static inline constexpr SDL_FColor editor = cream_paper; + static inline constexpr SDL_FColor editor_label = soft_blue; } diff --git a/src/wall/editor_wall.cpp b/src/wall/editor_wall.cpp index 00de647..8a95917 100644 --- a/src/wall/editor_wall.cpp +++ b/src/wall/editor_wall.cpp @@ -219,9 +219,9 @@ make_Number(const std::string& s, const Vec3& pos, float yaw) // red), so force orange afterwards. Text3dPtr t = make_Text3d(s, Text3d::depth_wall, ConfigWall::line_number_scale, pos, - ConfigColors::color_orange); + ConfigColor::orange); t->yaw = yaw; - t->set_Color(ConfigColors::color_orange); + t->set_Color(ConfigColor::orange); return t; } @@ -231,7 +231,7 @@ set_NumberText(Text3d* t, const std::string& s) if (t->text == s) return; t->text = s; t->rebuild_Mesh(); - t->set_Color(ConfigColors::color_orange); // rebuild can reset colour; keep orange + t->set_Color(ConfigColor::orange); // rebuild can reset colour; keep orange } } // namespace diff --git a/src/wall/text_wall.cpp b/src/wall/text_wall.cpp index 69fcf69..2131075 100644 --- a/src/wall/text_wall.cpp +++ b/src/wall/text_wall.cpp @@ -156,7 +156,7 @@ TextWall::show_TokenInfo(TextWallList& texts, pos.y = y; Text3dPtr t = make_Text3d(line, Text3d::depth_wall, 0.003f, - pos, ConfigColors::color_white); + pos, ConfigColor::white); t->yaw = tf.yaw; texts.push_back(cpputils::make_unique<TextWall>(TextWall{ diff --git a/src/wall/text_wall_scroll.hpp b/src/wall/text_wall_scroll.hpp index e9a12b0..a71ee9e 100644 --- a/src/wall/text_wall_scroll.hpp +++ b/src/wall/text_wall_scroll.hpp @@ -46,7 +46,7 @@ namespace TextWallScroll word->body.mode = PhysicsMode::Dynamic; word->body.vel = { 0.0, 1.5, 0.0 }; // small upward nudge word->body.hover_height = floor_y + 1.5; - word->set_Look(ConfigColors::color_floor, Text3d::depth_floor); + word->set_Look(ConfigColor::floor, Text3d::depth_floor); words.push_back(std::move(word)); } diff --git a/src/wall/wall_label.cpp b/src/wall/wall_label.cpp index 6ec68b6..fb7ecbc 100644 --- a/src/wall/wall_label.cpp +++ b/src/wall/wall_label.cpp @@ -24,12 +24,12 @@ static const char* label_Name(Wall::Role r) static SDL_FColor label_Color(Wall::Role r) { switch (r) { - case Wall::Role::Program: return ConfigColors::color_program_label; - case Wall::Role::Editor: return ConfigColors::color_editor_label; - case Wall::Role::Info: return ConfigColors::color_info_label; - case Wall::Role::Compiler: return ConfigColors::color_compiler_label; + case Wall::Role::Program: return ConfigColor::program_label; + case Wall::Role::Editor: return ConfigColor::editor_label; + case Wall::Role::Info: return ConfigColor::info_label; + case Wall::Role::Compiler: return ConfigColor::compiler_label; } - return ConfigColors::color_white; + return ConfigColor::white; } } // namespace diff --git a/src/wall/wall_surfaces.cpp b/src/wall/wall_surfaces.cpp index 13374d9..20c705d 100644 --- a/src/wall/wall_surfaces.cpp +++ b/src/wall/wall_surfaces.cpp @@ -7,13 +7,6 @@ namespace { -// Wall colors — picked to match each role's purpose. -constexpr SDL_FColor COLOR_EDITOR = { 0.066f, 0.113f, 0.18f, 1.0f }; // cream paper -constexpr SDL_FColor COLOR_PROGRAM = { 0.95f, 0.92f, 0.82f, 1.0f }; // warm ivory -constexpr SDL_FColor COLOR_INFO = { 0.42f, 0.52f, 0.63f, 1.0f }; // slate blue -constexpr SDL_FColor COLOR_COMPILER = { 0.06f, 0.05f, 0.12f, 1.0f }; // deep indigo - - // Build a quad mesh for one wall. The quad has an outward-facing normal // (pointing INTO the room) so the lighting/flashlight can illuminate it. // @@ -117,10 +110,10 @@ WallSurfaces::generate(float world_scale) bool is_editor; }; const Spec specs[4] = { - { Wall::Role::Editor, Wall::Position::NegX, COLOR_EDITOR, false }, - { Wall::Role::Program, Wall::Position::PosX, COLOR_PROGRAM, false }, - { Wall::Role::Info, Wall::Position::PosZ, COLOR_INFO, false }, - { Wall::Role::Compiler, Wall::Position::NegZ, COLOR_COMPILER, false }, + { Wall::Role::Editor, Wall::Position::NegX, ConfigColor::editor, false }, + { Wall::Role::Program, Wall::Position::PosX, ConfigColor::program, false }, + { Wall::Role::Info, Wall::Position::PosZ, ConfigColor::info, false }, + { Wall::Role::Compiler, Wall::Position::NegZ, ConfigColor::compiler, false }, }; for (size_t i = 0; i < 4; ++i) {