archivemuh
This commit is contained in:
42
archive/dusksdl2/display/scene/renderscene.c
Normal file
42
archive/dusksdl2/display/scene/renderscene.c
Normal file
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "renderscene.h"
|
||||
#include "display/overworld/renderoverworld.h"
|
||||
|
||||
renderscenecallback_t RENDER_SCENE_CALLBACKS[SCENE_COUNT] = {
|
||||
[SCENE_INITIAL] = {
|
||||
.init = NULL,
|
||||
.draw = NULL,
|
||||
.dispose = NULL
|
||||
},
|
||||
|
||||
[SCENE_OVERWORLD] = {
|
||||
.init = renderOverworldInit,
|
||||
.draw = renderOverworldDraw,
|
||||
.dispose = renderOverworldDispose
|
||||
},
|
||||
};
|
||||
|
||||
void renderSceneInit(void) {
|
||||
for(int32_t i = 0; i < SCENE_COUNT; i++) {
|
||||
if(!RENDER_SCENE_CALLBACKS[i].init) continue;
|
||||
RENDER_SCENE_CALLBACKS[i].init();
|
||||
}
|
||||
}
|
||||
|
||||
void renderSceneDraw(void) {
|
||||
if(!RENDER_SCENE_CALLBACKS[SCENE_CURRENT].draw) return;
|
||||
RENDER_SCENE_CALLBACKS[SCENE_CURRENT].draw();
|
||||
}
|
||||
|
||||
void renderSceneDispose(void) {
|
||||
for(int32_t i = 0; i < SCENE_COUNT; i++) {
|
||||
if(!RENDER_SCENE_CALLBACKS[i].dispose) continue;
|
||||
RENDER_SCENE_CALLBACKS[i].dispose();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user