From e1209ec25c4cc91e13889876106f56bd51aa96e2 Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Mon, 28 Sep 2015 10:11:13 +0200 Subject: [PATCH] move standalone stuff to its own dir --- src/app/runtime.cpp | 4 ++-- .../MasterState.cpp} | 20 ++++++++++--------- .../MasterState.hpp} | 14 ++++++++----- src/{app => standalone}/PreloadState.cpp | 4 +++- src/{app => standalone}/PreloadState.hpp | 9 ++++++--- src/{app => standalone}/UnloadState.cpp | 4 +++- src/{app => standalone}/UnloadState.hpp | 9 ++++++--- 7 files changed, 40 insertions(+), 24 deletions(-) rename src/{app/WorldState.cpp => standalone/MasterState.cpp} (86%) rename src/{app/WorldState.hpp => standalone/MasterState.hpp} (86%) rename src/{app => standalone}/PreloadState.cpp (93%) rename src/{app => standalone}/PreloadState.hpp (78%) rename src/{app => standalone}/UnloadState.cpp (94%) rename src/{app => standalone}/UnloadState.hpp (82%) diff --git a/src/app/runtime.cpp b/src/app/runtime.cpp index cc9d3bb..486259a 100644 --- a/src/app/runtime.cpp +++ b/src/app/runtime.cpp @@ -1,13 +1,13 @@ #include "Application.hpp" #include "Environment.hpp" #include "Runtime.hpp" -#include "WorldState.hpp" #include "init.hpp" #include "../client/MasterState.hpp" #include "../io/filesystem.hpp" #include "../io/WorldSave.hpp" #include "../server/ServerState.hpp" +#include "../standalone/MasterState.hpp" #include #include @@ -324,7 +324,7 @@ void Runtime::RunStandalone() { } Application app(env); - WorldState world_state(env, config.gen, config.interface, config.world, save); + standalone::MasterState world_state(env, config.gen, config.interface, config.world, save); app.PushState(&world_state); Run(app); } diff --git a/src/app/WorldState.cpp b/src/standalone/MasterState.cpp similarity index 86% rename from src/app/WorldState.cpp rename to src/standalone/MasterState.cpp index 590f6ac..30925a9 100644 --- a/src/app/WorldState.cpp +++ b/src/standalone/MasterState.cpp @@ -1,15 +1,16 @@ -#include "WorldState.hpp" +#include "MasterState.hpp" -#include "Environment.hpp" -#include "init.hpp" -#include "TextureIndex.hpp" +#include "../app/Environment.hpp" +#include "../app/init.hpp" +#include "../app/TextureIndex.hpp" #include namespace blank { +namespace standalone { -WorldState::WorldState( +MasterState::MasterState( Environment &env, const Generator::Config &gc, const Interface::Config &ic, @@ -39,13 +40,13 @@ WorldState::WorldState( } -void WorldState::OnEnter() { +void MasterState::OnEnter() { env.state.Push(&preload); env.window.GrabMouse(); } -void WorldState::Handle(const SDL_Event &event) { +void MasterState::Handle(const SDL_Event &event) { switch (event.type) { case SDL_KEYDOWN: interface.HandlePress(event.key); @@ -73,7 +74,7 @@ void WorldState::Handle(const SDL_Event &event) { } } -void WorldState::Update(int dt) { +void MasterState::Update(int dt) { interface.Update(dt); spawner.Update(dt); world.Update(dt); @@ -90,7 +91,7 @@ void WorldState::Update(int dt) { env.audio.Orientation(dir, up); } -void WorldState::Render(Viewport &viewport) { +void MasterState::Render(Viewport &viewport) { Entity &player = *interface.GetPlayer().entity; viewport.WorldPosition(player.Transform(player.ChunkCoords())); chunk_renderer.Render(viewport); @@ -101,3 +102,4 @@ void WorldState::Render(Viewport &viewport) { } } +} diff --git a/src/app/WorldState.hpp b/src/standalone/MasterState.hpp similarity index 86% rename from src/app/WorldState.hpp rename to src/standalone/MasterState.hpp index b48d1b9..ca5cab2 100644 --- a/src/app/WorldState.hpp +++ b/src/standalone/MasterState.hpp @@ -1,8 +1,9 @@ -#ifndef BLANK_APP_WORLDSTATE_HPP_ -#define BLANK_APP_WORLDSTATE_HPP_ +#ifndef BLANK_STANDALONE_MASTERSTATE_HPP_ +#define BLANK_STANDALONE_MASTERSTATE_HPP_ + +#include "../app/State.hpp" #include "PreloadState.hpp" -#include "State.hpp" #include "UnloadState.hpp" #include "../ai/Spawner.hpp" #include "../graphics/SkyBox.hpp" @@ -19,11 +20,13 @@ namespace blank { class Environment; -class WorldState +namespace standalone { + +class MasterState : public State { public: - WorldState( + MasterState( Environment &, const Generator::Config &, const Interface::Config &, @@ -58,6 +61,7 @@ private: }; +} } #endif diff --git a/src/app/PreloadState.cpp b/src/standalone/PreloadState.cpp similarity index 93% rename from src/app/PreloadState.cpp rename to src/standalone/PreloadState.cpp index 7d5f372..20d4c0f 100644 --- a/src/app/PreloadState.cpp +++ b/src/standalone/PreloadState.cpp @@ -1,11 +1,12 @@ #include "PreloadState.hpp" -#include "Environment.hpp" +#include "../app/Environment.hpp" #include "../world/ChunkLoader.hpp" #include "../world/ChunkRenderer.hpp" namespace blank { +namespace standalone { PreloadState::PreloadState(Environment &env, ChunkLoader &loader, ChunkRenderer &render) : env(env) @@ -40,3 +41,4 @@ void PreloadState::Render(Viewport &viewport) { } } +} diff --git a/src/app/PreloadState.hpp b/src/standalone/PreloadState.hpp similarity index 78% rename from src/app/PreloadState.hpp rename to src/standalone/PreloadState.hpp index 64936dc..8dcd706 100644 --- a/src/app/PreloadState.hpp +++ b/src/standalone/PreloadState.hpp @@ -1,7 +1,7 @@ -#ifndef BLANK_APP_PRELOADSTATE_HPP_ -#define BLANK_APP_PRELOADSTATE_HPP_ +#ifndef BLANK_STANDALONE_PRELOADSTATE_HPP_ +#define BLANK_STANDALONE_PRELOADSTATE_HPP_ -#include "State.hpp" +#include "../app/State.hpp" #include "../ui/Progress.hpp" @@ -14,6 +14,8 @@ class ChunkLoader; class ChunkRenderer; class Environment; +namespace standalone { + class PreloadState : public State { @@ -34,6 +36,7 @@ private: }; +} } #endif diff --git a/src/app/UnloadState.cpp b/src/standalone/UnloadState.cpp similarity index 94% rename from src/app/UnloadState.cpp rename to src/standalone/UnloadState.cpp index 43aae05..db1d2a5 100644 --- a/src/app/UnloadState.cpp +++ b/src/standalone/UnloadState.cpp @@ -1,11 +1,12 @@ #include "UnloadState.hpp" -#include "Environment.hpp" +#include "../app/Environment.hpp" #include "../io/WorldSave.hpp" #include "../world/ChunkLoader.hpp" namespace blank { +namespace standalone { UnloadState::UnloadState( Environment &env, @@ -55,3 +56,4 @@ void UnloadState::Render(Viewport &viewport) { } } +} diff --git a/src/app/UnloadState.hpp b/src/standalone/UnloadState.hpp similarity index 82% rename from src/app/UnloadState.hpp rename to src/standalone/UnloadState.hpp index ba7e809..5728ba7 100644 --- a/src/app/UnloadState.hpp +++ b/src/standalone/UnloadState.hpp @@ -1,7 +1,7 @@ -#ifndef BLANK_APP_UNLOADSTATE_HPP_ -#define BLANK_APP_UNLOADSTATE_HPP_ +#ifndef BLANK_STANDALONE_UNLOADSTATE_HPP_ +#define BLANK_STANDALONE_UNLOADSTATE_HPP_ -#include "State.hpp" +#include "../app/State.hpp" #include "../ui/Progress.hpp" @@ -16,6 +16,8 @@ class ChunkStore; class Environment; class WorldSave; +namespace standalone { + class UnloadState : public State { @@ -41,6 +43,7 @@ private: }; +} } #endif -- 2.39.2