X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp%2FWorldState.cpp;h=372b659f8975b4c564bc73a8d91485abb6eafd69;hb=82ec71079e4763f2b2d66c0c210e37df40c89034;hp=86e3eac93bdaa619fd344d7709f92b6ff4a65421;hpb=29ee0558fdd951b25f41005ed721241b1f28aefa;p=blank.git diff --git a/src/app/WorldState.cpp b/src/app/WorldState.cpp index 86e3eac..372b659 100644 --- a/src/app/WorldState.cpp +++ b/src/app/WorldState.cpp @@ -1,7 +1,6 @@ #include "WorldState.hpp" #include "Environment.hpp" -#include "UnloadState.hpp" #include @@ -17,11 +16,18 @@ WorldState::WorldState( : env(env) , world(env.assets, wc, save) , spawner(world) -, interface(ic, env, world) { +, interface(ic, env, world) +, preload(env, world.Loader()) +, unload(env, world.Loader()) { } +void WorldState::OnEnter() { + env.state.Push(&preload); +} + + void WorldState::Handle(const SDL_Event &event) { switch (event.type) { case SDL_KEYDOWN: @@ -43,8 +49,7 @@ void WorldState::Handle(const SDL_Event &event) { interface.Handle(event.wheel); break; case SDL_QUIT: - // don't care about this leak just now - env.state.Switch(new UnloadState(env, world.Loader())); + env.state.Switch(&unload); break; default: break;