]> git.localhorst.tv Git - blobs.git/blob - src/app/Application.hpp
switch creatures with left click
[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         Window &GetWindow() noexcept { return window; }
36         const Window &GetWindow() const noexcept { return window; }
37
38         graphics::Viewport &GetViewport() noexcept { return viewport; }
39         const graphics::Viewport &GetViewport() const noexcept { return viewport; }
40
41         /// Loop until states is empty.
42         void Run();
43         /// Evaluate a single frame of dt milliseconds.
44         void Loop(int dt);
45         /// Process all events in queue.
46         void HandleEvents();
47
48 private:
49         Window &window;
50         graphics::Viewport &viewport;
51         std::stack<State *> states;
52
53 };
54
55 }
56 }
57
58 #endif