Nugget
application.hh
1 /*
2 
3 MIT License
4 
5 Copyright (c) 2022 PCSX-Redux authors
6 
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13 
14 The above copyright notice and this permission notice shall be included in all
15 copies or substantial portions of the Software.
16 
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 SOFTWARE.
24 
25 */
26 
27 #pragma once
28 
29 #include <EASTL/fixed_vector.h>
30 
31 #include "psyqo/gpu.hh"
32 
33 namespace psyqo {
34 
35 class Scene;
36 
49 class Application {
50  public:
56  int run();
57 
65  virtual void prepare() {}
66 
73  virtual void createScene() {}
74 
80  psyqo::GPU& gpu() { return m_gpu; }
81 
88 
97  void pushScene(Scene* scene);
98 
112  Scene* popScene();
113 
114  virtual ~Application() = default;
115 
116  private:
117  psyqo::GPU m_gpu;
118  eastl::fixed_vector<Scene*, 16> m_scenesStack;
119 
120  friend class Scene;
121 };
122 
123 } // namespace psyqo
Definition: fixed_vector.h:72
The application class.
Definition: application.hh:49
Scene * getCurrentScene()
Get the current scene object.
Definition: application.cpp:59
virtual void createScene()
Create the root scene object.
Definition: application.hh:73
Scene * popScene()
Pop a scene object from the stack.
Definition: application.cpp:75
virtual void prepare()
Prepare the objects for the application.
Definition: application.hh:65
void pushScene(Scene *scene)
Push a scene object onto the stack.
Definition: application.cpp:66
psyqo::GPU & gpu()
Get the GPU object.
Definition: application.hh:80
int run()
Runs the main loop.
Definition: application.cpp:39
The singleton GPU class.
Definition: gpu.hh:57
The Scene class.
Definition: scene.hh:42