1 #ifndef APP_APPLICATION_H_
2 #define APP_APPLICATION_H_
21 /// Application controller class.
22 /// Operates on a state stack that can be modified via ChangeState, PushState,
24 /// All state changes are delayed until the looping mechanism gets control again
25 /// (i.e. after a top level state function returns, not during).
26 /// SDL key events are preprocessed, see app::Input.
27 /// The quit event (typically window closed or signal received) is caught and
28 /// results in immediate (that is, after the next input loop) termination.
29 /// Popped states will be deleted via the plain delete operator on an app::State
31 /// Timers created by GlobalTimers() operate on actual application time and are
32 /// not paused when the current state is paused (as are the timers started by
33 /// the app::State members).
37 Application(sdl::InitScreen &screen, State *initialState);
40 Application(const Application &);
41 Application &operator =(const Application &);
48 void ChangeState(State *);
49 void PushState(State *);
52 Input &Buttons() { return input; }
53 const Input &Buttons() const { return input; }
54 Timers<Uint32> &GlobalTimers() { return globalTimers; }
65 State *CurrentState();
66 bool StateChangePending() const { return !stateChanges.empty(); }
68 void RealChangeState(State *);
69 void RealPushState(State *);
75 void UpdateWorld(Uint32 deltaT);
79 sdl::InitScreen &screen;
80 std::stack<State *> states;
81 std::queue<StateCommand> stateChanges;
82 Timers<Uint32> globalTimers;