scerne stuff

This commit is contained in:
2025-10-01 19:21:20 -05:00
parent 83243ba32f
commit 4b04fc65ad
19 changed files with 150 additions and 76 deletions

View File

@@ -16,7 +16,6 @@ add_subdirectory(framebuffer)
add_subdirectory(mesh)
add_subdirectory(palette)
add_subdirectory(texture)
add_subdirectory(scene)
add_subdirectory(spritebatch)
if(DUSK_TARGET_SYSTEM STREQUAL "linux")

View File

@@ -8,7 +8,7 @@
#include "display/display.h"
#include "console/console.h"
#include "display/framebuffer/framebuffer.h"
#include "display/scene/scenemanager.h"
#include "scene/scenemanager.h"
#include "display/spritebatch/spritebatch.h"
#include "display/mesh/quad.h"
#include "game/game.h"
@@ -71,7 +71,6 @@ errorret_t displayInit(void) {
quadInit();
frameBufferInitBackbuffer();
spriteBatchInit();
errorChain(sceneManagerInit());
errorOk();
}
@@ -115,7 +114,7 @@ errorret_t displayUpdate(void) {
COLOR_CORNFLOWER_BLUE
);
gameRender();
sceneManagerRender();
spriteBatchFlush();
#if DISPLAY_SDL2
@@ -132,7 +131,6 @@ errorret_t displayUpdate(void) {
}
errorret_t displayDispose(void) {
sceneManagerDispose();
spriteBatchDispose();
#if DISPLAY_SDL2

View File

@@ -1,12 +0,0 @@
# Copyright (c) 2025 Dominic Masters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
# Sources
target_sources(${DUSK_TARGET_NAME}
PRIVATE
scenemanager.c
)
# Subdirs

View File

@@ -1,24 +0,0 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "dusk.h"
#include "error/error.h"
#define SCENE_FLAG_VISIBLE (1 << 0)
#define SCENE_FLAG_ACTIVE (1 << 1)
typedef struct {
errorret_t (*init)(void);
void (*update)(void);
void (*render)(void);
void (*dispose)(void);
void (*active)(void);
void (*sleep)(void);
uint8_t flags;
} scene_t;

View File

@@ -1,58 +0,0 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "scenemanager.h"
scenemanager_t SCENE_MANAGER;
// scene_t SCENE_MANAGER_SCENES[SCENE_TYPE_COUNT] = {
// [SCENE_TYPE_LOGO] = { 0 },
// [SCENE_TYPE_TEST] = {
// .init = sceneTestInit,
// .update = sceneTestUpdate,
// .render = sceneTestRender,
// .dispose = sceneTestDispose
// },
// [SCENE_TYPE_OVERWORLD] = {
// .init = sceneOverworldInit,
// .update = sceneOverworldUpdate,
// .render = sceneOverworldRender,
// .dispose = sceneOverworldDispose
// }
// };
errorret_t sceneManagerInit(void) {
// scene_t *initial = &SCENE_MANAGER_SCENES[SCENE_TYPE_INITIAL];
// if(initial->init != NULL) errorChain(initial->init());
errorOk();
}
void sceneManagerUpdate(void) {
// For each scene.
// for(uint8_t i = 0; i < SCENE_TYPE_COUNT; i++) {
// scene_t *scene = &SCENE_MANAGER_SCENES[i];
// if((scene->flags & SCENE_FLAG_ACTIVE) == 0) continue;
// if(scene->update != NULL) scene->update();
// }
}
void sceneManagerRender(void) {
// for(uint8_t i = 0; i < SCENE_TYPE_COUNT; i++) {
// scene_t *scene = &SCENE_MANAGER_SCENES[i];
// if((scene->flags & SCENE_FLAG_VISIBLE) == 0) continue;
// if(scene->render != NULL) scene->render();
// }
}
void sceneManagerDispose(void) {
// for(uint8_t i = 0; i < SCENE_TYPE_COUNT; i++) {
// scene_t *scene = &SCENE_MANAGER_SCENES[i];
// if(scene->dispose != NULL) scene->dispose();
// }
}

View File

@@ -1,36 +0,0 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "scene.h"
typedef struct {
int nothing;
} scenemanager_t;
extern scenemanager_t SCENE_MANAGER;
// extern scene_t SCENE_MANAGER_SCENES[SCENE_TYPE_COUNT];
/**
* Initializes the scene manager and the initial scene.
*/
errorret_t sceneManagerInit(void);
/**
* Updates all active scenes.
*/
void sceneManagerUpdate(void);
/**
* Renders all visible scenes.
*/
void sceneManagerRender(void);
/**
* Disposes of all scenes.
*/
void sceneManagerDispose(void);