X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp%2FState.h;fp=src%2Fapp%2FState.h;h=2a4b5e1bfd93176b8b9b4ebea58dfcfe9f519e8c;hb=3f8fac16c7ae2cbe7da47b98aba9b558825723e7;hp=a84afde9941a26b0809cdd20c884f9e6ab0920be;hpb=7252571fb926a187c4c40e8f4eec718f16d63ffa;p=l2e.git diff --git a/src/app/State.h b/src/app/State.h index a84afde..2a4b5e1 100644 --- a/src/app/State.h +++ b/src/app/State.h @@ -19,6 +19,7 @@ namespace app { class State { public: + State(); virtual ~State(); public: @@ -41,6 +42,13 @@ public: /// Draw a picture of the world. virtual void Render(SDL_Surface *) = 0; +protected: + /// Get a handle to the application this state is running on. + /// Do not call this while the state is off the stack (e.g. in c'tor/d'tor) + /// or you'll get a std::domain_error (potentially evil in d'tor)! + Application &Ctrl(); + const Application &Ctrl() const; + private: /// Do some setup that needs an application and/or screen handle and thus /// can not be done by the constructor. @@ -72,6 +80,7 @@ public: Timers &PhysicsTimers() { return physicsTimers; } private: + Application *ctrl; Timers graphicsTimers; Timers physicsTimers;