X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp%2FApplication.h;h=853d0cb25cefc91897beeaa41e7365f027a2604a;hb=2a0eca649009f78028db286a67a532429cab5b88;hp=909942b829730020ecd598e368bcbaefc4d7edcb;hpb=4a1816af30dcfe53181a25355bd51cc7b24a83f1;p=l2e.git diff --git a/src/app/Application.h b/src/app/Application.h index 909942b..853d0cb 100644 --- a/src/app/Application.h +++ b/src/app/Application.h @@ -8,9 +8,11 @@ #ifndef APP_APPLICATION_H_ #define APP_APPLICATION_H_ +#include "Input.h" #include "../sdl/InitScreen.h" #include +#include #include @@ -22,35 +24,49 @@ class Application { public: Application(sdl::InitScreen *screen, State *initialState); - ~Application(void); + ~Application(); private: Application(const Application &); Application &operator =(const Application &); public: - void Run(void); - void Loop(void); + void Run(); + void Loop(); public: void ChangeState(State *); void PushState(State *); - void PopState(void); - void Quit(void); + void PopState(); + void Quit(); + Input &Buttons() { return input; } + const Input &Buttons() const { return input; } private: - State *CurrentState(void); + struct StateCommand { + enum Type { + PUSH, POP, CHANGE + } type; + State *state; + }; + +private: + State *CurrentState(); + void UpdateState(); + void RealChangeState(State *); void RealPushState(State *); - void RealPopState(void); - void PopAllStates(void); + void RealPopState(); + void PopAllStates(); private: - void HandleEvents(void); + void HandleEvents(); void UpdateWorld(Uint32 deltaT); - void Render(void); + void Render(); private: sdl::InitScreen *screen; std::stack states; + std::queue stateChanges; + Input input; Uint32 last; };