1 #ifndef APP_APPLICATION_H_
2 #define APP_APPLICATION_H_
7 #include "../sdl/InitScreen.h"
16 /// Application controller class.
17 /// Operates on a state stack that can be modified via ChangeState, PushState,
19 /// All state changes are delayed until the looping mechanism gets control again
20 /// (i.e. after a top level state function returns, not during).
21 /// SDL key events are preprocessed, see app::Input.
22 /// The quit event (typically window closed or signal received) is caught and
23 /// results in immediate (that is, after the next input loop) termination.
24 /// Popped states will be deleted via the plain delete operator on an app::State
26 /// Timers created by GlobalTimers() operate on actual application time and are
27 /// not paused when the current state is paused (as are the timers started by
28 /// the app::State members).
32 Application(sdl::InitScreen &screen, State *initialState);
35 Application(const Application &);
36 Application &operator =(const Application &);
43 void ChangeState(State *);
44 void PushState(State *);
47 Input &Buttons() { return input; }
48 const Input &Buttons() const { return input; }
49 Timers<Uint32> &GlobalTimers() { return globalTimers; }
60 State *CurrentState();
61 bool StateChangePending() const { return !stateChanges.empty(); }
63 void RealChangeState(State *);
64 void RealPushState(State *);
70 void UpdateWorld(Uint32 deltaT);
74 sdl::InitScreen &screen;
75 std::stack<State *> states;
76 std::queue<StateCommand> stateChanges;
77 Timers<Uint32> globalTimers;
86 #endif /* APP_APPLICATION_H_ */