#define APP_APPLICATION_H_
#include "Input.h"
+#include "Timer.h"
#include "../sdl/InitScreen.h"
#include <stack>
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();
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;
};