]> git.localhorst.tv Git - l2e.git/blobdiff - src/app/Application.h
added forwarding headers
[l2e.git] / src / app / Application.h
index dcc5e006c0dc36d28b65859bcbb048761cfc96be..b7b0001f7bbbf874a193f7a8dbaeb0e2cd50a07a 100644 (file)
@@ -8,7 +8,9 @@
 #ifndef APP_APPLICATION_H_
 #define APP_APPLICATION_H_
 
+#include "fwd.h"
 #include "Input.h"
+#include "Timer.h"
 #include "../sdl/InitScreen.h"
 
 #include <stack>
@@ -18,8 +20,6 @@
 
 namespace app {
 
-class State;
-
 class Application {
 
 public:
@@ -40,10 +40,21 @@ public:
        void Quit();
        Input &Buttons() { return input; }
        const Input &Buttons() const { return input; }
+       Timers<Uint32> &GlobalTimers() { return globalTimers; }
+
+private:
+       struct StateCommand {
+               enum Type {
+                       PUSH, POP, CHANGE
+               } type;
+               State *state;
+       };
 
 private:
        State *CurrentState();
+       bool StateChangePending() const { return !stateChanges.empty(); }
        void UpdateState();
+       void RealChangeState(State *);
        void RealPushState(State *);
        void RealPopState();
        void PopAllStates();
@@ -56,10 +67,10 @@ private:
 private:
        sdl::InitScreen *screen;
        std::stack<State *> states;
-       std::queue<State *> toPush;
+       std::queue<StateCommand> stateChanges;
+       Timers<Uint32> globalTimers;
        Input input;
        Uint32 last;
-       int toPop;
 
 };