From 492a2804c8a6767a19d2bda84d0855099e033e7a Mon Sep 17 00:00:00 2001 From: brxxh <11dac2t@huhn-online.de> Date: Wed, 2 Jul 2025 12:07:26 +0200 Subject: [PATCH] Make the world/plane type configurable --- examples/tappyplane/tappyplane.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/tappyplane/tappyplane.cpp b/examples/tappyplane/tappyplane.cpp index 0bc2399..6afdf36 100644 --- a/examples/tappyplane/tappyplane.cpp +++ b/examples/tappyplane/tappyplane.cpp @@ -32,6 +32,12 @@ namespace TappyPlane { using SpriteName = std::tuple; using SpriteMap = std::unordered_map; +enum class WorldType { Dirt, Grass, Ice, Rock, Snow }; +enum class PlaneType { Blue, Green, Red, Yellow }; + +static const WorldType WORLD_TYPE = TappyPlane::WorldType::Grass; +static const PlaneType PLANE_TYPE = TappyPlane::PlaneType::Red; + static const unsigned int FRAME_RATE = 60; static const unsigned int WINDOW_WIDTH = 800; @@ -556,9 +562,6 @@ enum class GameState { Start, Playing, GameOver }; struct App { SpriteMap sprites; - enum class WorldType { Dirt, Grass, Ice, Rock, Snow }; - enum class PlaneType { Blue, Green, Red, Yellow }; - static auto create(WorldType world_type = WorldType::Grass, PlaneType plane_type = PlaneType::Red) -> App { auto app = App{}; @@ -815,10 +818,7 @@ struct App { auto main() -> int { std::srand(std::time(nullptr)); - auto world_type = TappyPlane::App::WorldType::Grass; - auto plane_type = TappyPlane::App::PlaneType::Red; - - auto app = TappyPlane::App::create(world_type, plane_type); + auto app = TappyPlane::App::create(TappyPlane::WORLD_TYPE, TappyPlane::PLANE_TYPE); app.run(); return 0; }