DSC Engine
Loading...
Searching...
No Matches
scene.hpp
Go to the documentation of this file.
1
6#pragma once
7
9
10namespace DSC
11{
12 struct SceneCom;
13
16 class Scene
17 {
18 public:
23 Scene() = default;
24
83
86 virtual void init();
87
90 virtual void frame();
91
92 __attribute__((noinline))
93 virtual void run();
94
97
100
103
104 virtual ~Scene() = default;
105 };
106
111 struct SceneCom
112 {
116 void next(Scene* new_scene);
117 };
118
119
120 extern Scene* __MAIN_SCENE__;
121
122 extern void init_main_scene();
123
124 #ifdef DSC_INTERNAL
125 extern SceneCom __SceneComInstance__;
126 #endif
127}
128
129#define dsc_launch(scene_t,...) void DSC::init_main_scene(){DSC::__MAIN_SCENE__=new scene_t(__VA_ARGS__);}
Class responsible with event registration and execution.
Definition: event.hpp:76
An active game execution part
Definition: scene.hpp:17
Event key_held
Key held event.
Definition: scene.hpp:99
Scene()=default
Creates a new Scene instance
Event key_down
Key down event.
Definition: scene.hpp:96
virtual void frame()
The Scene main loop logic. This method is executed at VBlank.
virtual void init()
Contains Scene initialization routines (setting variables, loading VRAM etc.)
Event key_up
Key up event.
Definition: scene.hpp:102
SceneCom * close()
Closes this scene and clears all its resources.
Inter-Scene communication object.
Definition: scene.hpp:112
void next(Scene *new_scene)
Loads the next scene.