A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
SceneManager.hh
1#pragma once
2
3#include "egg/core/Scene.hh"
4#include "egg/core/SceneCreator.hh"
5
6namespace Kinoko {
7
8namespace Host {
9
10class Context;
11
12} // namespace Host
13
14namespace EGG {
15
18 friend class Host::Context;
19
20public:
21 /*------------*
22 Lifecycle
23 *------------*/
24
25 SceneManager(SceneCreator *creator = nullptr);
26 virtual ~SceneManager();
27
28 /*----------*
29 Virtual
30 *----------*/
31
32 virtual void calc();
33 virtual void calcCurrentScene();
34
35 /*----------*
36 Methods
37 *----------*/
38
39 void createChildScene(int nextSceneId, Scene *parent);
40 void createScene(int nextSceneId, Scene *parent);
41 void destroyScene(Scene *scene);
42
43 void changeScene(int nextSceneId);
44 void changeSiblingScene(int nextSceneId);
45 void changeSiblingScene();
46 void incomingCurrentScene();
47 void outgoingParentScene(Scene *parent);
48 void reinitCurrentScene();
49
50 bool destroyCurrentSceneNoIncoming(bool destroyRootIfNoParent);
51 bool destroyToSelectSceneId(int nextSceneId);
52 [[nodiscard]] Scene *findParentScene(int id) const;
53 void setupNextSceneId();
54
55 /*----------*
56 Getters
57 *----------*/
58
59 [[nodiscard]] Scene *currentScene() const {
60 return m_currentScene;
61 }
62
63 [[nodiscard]] int currentSceneId() const {
64 return m_currentSceneId;
65 }
66
67 [[nodiscard]] static Heap *heapForCreateScene() {
68 return s_heapForCreateScene;
69 }
70
71 /*----------*
72 Setters
73 *----------*/
74
75 void setNextSceneId(int id) {
76 m_nextSceneId = id;
77 }
78
79 static void SetRootHeap(Heap *heap) {
80 s_rootHeap = heap;
81 }
82
83private:
84 /*----------*
85 Members
86 *----------*/
87
88 SceneCreator *m_creator;
89 Scene *m_currentScene;
90 int m_nextSceneId;
91 int m_currentSceneId;
92 int m_prevSceneId;
93
94 static Heap *s_heapForCreateScene;
95 static u16 s_heapOptionFlg;
96
97 static Heap *s_rootHeap;
98};
99
100} // namespace EGG
101
102} // namespace Kinoko
A high-level representation of a memory heap for managing dynamic memory allocation....
Definition Heap.hh:24
Interface for creating and destroying scenes.
Manages the scene stack and transitions between scenes.
Base class for all scenes.
Definition Scene.hh:16
Contexts can be used to restore a previous memory state for the current session.
Definition Context.hh:70