X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp%2FApplication.h;h=e29bc63feb885e613efea2fd998565d48803c144;hb=092a2dd175a4001a495c84ee85211734fb928c83;hp=41198bce88c4f2e4f5ca1a7c07c8af9c713d9c8b;hpb=3f9f41338d8100a719e161a3a1cdda9dd227e2b4;p=l2e.git diff --git a/src/app/Application.h b/src/app/Application.h index 41198bc..e29bc63 100644 --- a/src/app/Application.h +++ b/src/app/Application.h @@ -1,17 +1,15 @@ -/* - * Application.h - * - * Created on: Apr 8, 2012 - * Author: holy - */ - #ifndef APP_APPLICATION_H_ #define APP_APPLICATION_H_ -#include "fwd.h" +namespace app { + class State; +} +namespace sdl { + class InitScreen; +} + #include "Input.h" #include "Timer.h" -#include "../sdl/InitScreen.h" #include #include @@ -20,10 +18,23 @@ namespace app { +/// Application controller class. +/// Operates on a state stack that can be modified via ChangeState, PushState, +/// and PopState. +/// All state changes are delayed until the looping mechanism gets control again +/// (i.e. after a top level state function returns, not during). +/// SDL key events are preprocessed, see app::Input. +/// The quit event (typically window closed or signal received) is caught and +/// results in immediate (that is, after the next input loop) termination. +/// Popped states will be deleted via the plain delete operator on an app::State +/// pointer. +/// Timers created by GlobalTimers() operate on actual application time and are +/// not paused when the current state is paused (as are the timers started by +/// the app::State members). class Application { public: - Application(sdl::InitScreen *screen, State *initialState); + Application(sdl::InitScreen &screen, State *initialState); ~Application(); private: Application(const Application &); @@ -65,7 +76,7 @@ private: void Render(); private: - sdl::InitScreen *screen; + sdl::InitScreen &screen; std::stack states; std::queue stateChanges; Timers globalTimers;