]> git.localhorst.tv Git - blobs.git/blob - src/app/Application.hpp
040935f714d2a2a7081470a4dd31ba660faec024
[blobs.git] / src / app / Application.hpp
1 #ifndef BLOBS_APP_APPLICATION_HPP_
2 #define BLOBS_APP_APPLICATION_HPP_
3
4 #include <stack>
5
6
7 namespace blobs {
8 namespace graphics {
9         class Viewport;
10 }
11 namespace app {
12
13 class State;
14 class Window;
15
16 class Application {
17
18 public:
19         Application(Window &, graphics::Viewport &);
20         ~Application();
21
22         Application(const Application &) = delete;
23         Application &operator =(const Application &) = delete;
24
25         Application(Application &&) = delete;
26         Application &operator =(Application &&) = delete;
27
28 public:
29         void PushState(State *);
30         State *PopState();
31         State *SwitchState(State *);
32         State &GetState();
33         bool HasState() const noexcept;
34
35         /// Loop until states is empty.
36         void Run();
37         /// Evaluate a single frame of dt milliseconds.
38         void Loop(int dt);
39         /// Process all events in queue.
40         void HandleEvents();
41
42 private:
43         Window &window;
44         graphics::Viewport &viewport;
45         std::stack<State *> states;
46
47 };
48
49 }
50 }
51
52 #endif