Make the world/plane type configurable
This commit is contained in:
parent
7ecf57c7c0
commit
492a2804c8
1 changed files with 7 additions and 7 deletions
|
@ -32,6 +32,12 @@ namespace TappyPlane {
|
||||||
using SpriteName = std::tuple<std::string_view, std::string_view>;
|
using SpriteName = std::tuple<std::string_view, std::string_view>;
|
||||||
using SpriteMap = std::unordered_map<std::string_view, paradiso::Bitmap>;
|
using SpriteMap = std::unordered_map<std::string_view, paradiso::Bitmap>;
|
||||||
|
|
||||||
|
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 FRAME_RATE = 60;
|
||||||
|
|
||||||
static const unsigned int WINDOW_WIDTH = 800;
|
static const unsigned int WINDOW_WIDTH = 800;
|
||||||
|
@ -556,9 +562,6 @@ enum class GameState { Start, Playing, GameOver };
|
||||||
struct App {
|
struct App {
|
||||||
SpriteMap sprites;
|
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,
|
static auto create(WorldType world_type = WorldType::Grass,
|
||||||
PlaneType plane_type = PlaneType::Red) -> App {
|
PlaneType plane_type = PlaneType::Red) -> App {
|
||||||
auto app = App{};
|
auto app = App{};
|
||||||
|
@ -815,10 +818,7 @@ struct App {
|
||||||
auto main() -> int {
|
auto main() -> int {
|
||||||
std::srand(std::time(nullptr));
|
std::srand(std::time(nullptr));
|
||||||
|
|
||||||
auto world_type = TappyPlane::App::WorldType::Grass;
|
auto app = TappyPlane::App::create(TappyPlane::WORLD_TYPE, TappyPlane::PLANE_TYPE);
|
||||||
auto plane_type = TappyPlane::App::PlaneType::Red;
|
|
||||||
|
|
||||||
auto app = TappyPlane::App::create(world_type, plane_type);
|
|
||||||
app.run();
|
app.run();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue