1 #ifndef BLANK_APP_APPLICATION_HPP_
2 #define BLANK_APP_APPLICATION_HPP_
11 class HeadlessEnvironment;
15 class HeadlessApplication {
18 explicit HeadlessApplication(HeadlessEnvironment &);
19 ~HeadlessApplication();
21 void PushState(State *);
23 State *SwitchState(State *);
26 bool HasState() const noexcept;
28 /// run until out of states
30 /// evaluate a single frame of dt milliseconds
31 virtual void Loop(int dt);
35 /// run for t milliseconds
37 /// run for n frames, assuming t milliseconds for each
38 void RunS(size_t n, size_t t);
40 /// process all events in SDL's queue
42 void Handle(const SDL_Event &);
43 /// integrate to the next step with dt milliseconds passed
47 HeadlessEnvironment &env;
48 std::stack<State *> states;
54 : public HeadlessApplication {
57 explicit Application(Environment &);
60 Application(const Application &) = delete;
61 Application &operator =(const Application &) = delete;
63 void Loop(int dt) override;
65 /// process all events in SDL's queue
67 void Handle(const SDL_Event &);
68 void Handle(const SDL_WindowEvent &);
69 /// integrate to the next step with dt milliseconds passed
71 /// push the current state to display