Nothing really changed
This commit is contained in:
@@ -10,7 +10,6 @@ target_sources(${DUSK_TARGET_NAME}
|
||||
renderbackbuffer.c
|
||||
rendertext.c
|
||||
renderconsole.c
|
||||
renderscene.c
|
||||
)
|
||||
|
||||
# Subdirs
|
||||
@@ -18,4 +17,5 @@ add_subdirectory(camera)
|
||||
add_subdirectory(framebuffer)
|
||||
add_subdirectory(mesh)
|
||||
add_subdirectory(texture)
|
||||
add_subdirectory(spritebatch)
|
||||
add_subdirectory(spritebatch)
|
||||
add_subdirectory(scene)
|
||||
@@ -11,8 +11,7 @@
|
||||
#include "rendertext.h"
|
||||
#include "renderconsole.h"
|
||||
#include "console/console.h"
|
||||
#include "dusksdl2input.h"
|
||||
#include "renderscene.h"
|
||||
#include "display/scene/renderscene.h"
|
||||
#include "display/spritebatch/spritebatch.h"
|
||||
#include "display/camera/camera.h"
|
||||
|
||||
@@ -95,10 +94,10 @@ errorret_t renderDraw(void) {
|
||||
spriteBatchClear();
|
||||
renderBackBufferBind();
|
||||
|
||||
// Draw everything
|
||||
// Draw the scene
|
||||
renderSceneDraw();
|
||||
|
||||
// UI
|
||||
// Draw UI
|
||||
cameraUIPush();
|
||||
renderConsoleDraw();
|
||||
spriteBatchFlush();
|
||||
|
||||
@@ -10,9 +10,7 @@
|
||||
#include "rendertext.h"
|
||||
|
||||
void renderConsoleDraw(void) {
|
||||
// if(!CONSOLE.visible) return;
|
||||
|
||||
// renderTextDraw(0, 0, "Dusk Console");
|
||||
if(!CONSOLE.visible) return;
|
||||
|
||||
int32_t i = 0;
|
||||
char_t *line;
|
||||
|
||||
8
src/dusksdl2/display/renderoverworld.h
Normal file
8
src/dusksdl2/display/renderoverworld.h
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -1,20 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "renderscene.h"
|
||||
|
||||
void renderSceneInit(void) {
|
||||
// Initialize scene-related resources here
|
||||
}
|
||||
|
||||
void renderSceneDraw(void) {
|
||||
// Draw the current scene here
|
||||
}
|
||||
|
||||
void renderSceneDispose(void) {
|
||||
// Dispose of scene-related resources here
|
||||
}
|
||||
13
src/dusksdl2/display/scene/CMakeLists.txt
Normal file
13
src/dusksdl2/display/scene/CMakeLists.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
# 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
|
||||
renderscene.c
|
||||
)
|
||||
|
||||
# Subdirs
|
||||
# add_subdirectory(draw)
|
||||
44
src/dusksdl2/display/scene/renderscene.c
Normal file
44
src/dusksdl2/display/scene/renderscene.c
Normal file
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "renderscene.h"
|
||||
|
||||
renderscenecallback_t RENDER_SCENE_CALLBACKS[SCENE_COUNT] = {
|
||||
[SCENE_INITIAL] = {
|
||||
.init = NULL,
|
||||
.draw = NULL,
|
||||
.dispose = NULL
|
||||
},
|
||||
|
||||
[SCENE_OVERWORLD] = {
|
||||
.init = NULL,
|
||||
.draw = NULL,
|
||||
.dispose = NULL
|
||||
},
|
||||
};
|
||||
|
||||
void renderSceneInit(void) {
|
||||
for (int i = 0; i < SCENE_COUNT; i++) {
|
||||
if (RENDER_SCENE_CALLBACKS[i].init) {
|
||||
RENDER_SCENE_CALLBACKS[i].init();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void renderSceneDraw(void) {
|
||||
if(RENDER_SCENE_CALLBACKS[SCENE_CURRENT].draw) {
|
||||
RENDER_SCENE_CALLBACKS[SCENE_CURRENT].draw();
|
||||
}
|
||||
}
|
||||
|
||||
void renderSceneDispose(void) {
|
||||
for (int i = 0; i < SCENE_COUNT; i++) {
|
||||
if (RENDER_SCENE_CALLBACKS[i].dispose) {
|
||||
RENDER_SCENE_CALLBACKS[i].dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,15 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "dusk.h"
|
||||
#include "display/scene.h"
|
||||
|
||||
typedef struct {
|
||||
void (*init)(void);
|
||||
void (*draw)(void);
|
||||
void (*dispose)(void);
|
||||
} renderscenecallback_t;
|
||||
|
||||
extern renderscenecallback_t RENDER_SCENE_CALLBACKS[SCENE_COUNT];
|
||||
|
||||
/**
|
||||
* Initializes the render scene module.
|
||||
@@ -7,8 +7,8 @@
|
||||
|
||||
#include "dusksdl2input.h"
|
||||
|
||||
uint8_t inputStateGet() {
|
||||
uint8_t state = 0;
|
||||
inputstate_t inputStateGet() {
|
||||
inputstate_t state = 0;
|
||||
|
||||
#if INPUT_SUPPORT_GAMEPAD
|
||||
// Get gamepad state.
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#if INPUT_SUPPORT_GAMEPAD
|
||||
typedef struct {
|
||||
const SDL_GameControllerButton button;
|
||||
const uint8_t bind;
|
||||
const inputbind_t bind;
|
||||
} inputsdlbuttonmap_t;
|
||||
|
||||
static const inputsdlbuttonmap_t INPUT_SDL_BUTTON_MAP[] = {
|
||||
@@ -30,6 +30,7 @@
|
||||
{ SDL_CONTROLLER_BUTTON_DPAD_RIGHT, INPUT_BIND_RIGHT },
|
||||
{ SDL_CONTROLLER_BUTTON_A, INPUT_BIND_ACTION },
|
||||
{ SDL_CONTROLLER_BUTTON_B, INPUT_BIND_CANCEL },
|
||||
{ SDL_CONTROLLER_BUTTON_MISC1, INPUT_BIND_CONSOLE },
|
||||
{ 0, 0 }
|
||||
};
|
||||
#endif
|
||||
@@ -37,7 +38,7 @@
|
||||
#if INPUT_SUPPORT_KEYBOARD
|
||||
typedef struct {
|
||||
SDL_Scancode code;
|
||||
uint8_t bind;
|
||||
inputbind_t bind;
|
||||
} inputsdlkbmap_t;
|
||||
|
||||
static const inputsdlkbmap_t INPUT_SDL_KEYBOARD_MAP[] = {
|
||||
@@ -47,6 +48,7 @@
|
||||
{ SDL_SCANCODE_D, INPUT_BIND_RIGHT },
|
||||
{ SDL_SCANCODE_SPACE, INPUT_BIND_ACTION },
|
||||
{ SDL_SCANCODE_ESCAPE, INPUT_BIND_CANCEL },
|
||||
{ SDL_SCANCODE_GRAVE, INPUT_BIND_CONSOLE },
|
||||
{ 0, 0 }
|
||||
};
|
||||
#endif
|
||||
Reference in New Issue
Block a user