Refator pass 1

This commit is contained in:
2025-10-06 19:14:52 -05:00
parent 85434b4edb
commit fc52afdb00
113 changed files with 96 additions and 726 deletions

View File

@@ -0,0 +1,10 @@
# 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
scenetest.c
)

View File

@@ -0,0 +1,48 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "scenetest.h"
#include "display/scene/scenemanager.h"
#include "display/spritebatch.h"
scenetest_t SCENE_TEST;
errorret_t sceneTestInit(void) {
cameraInit(&SCENE_TEST.camera);
SCENE_TEST.camera.projType = CAMERA_PROJECTION_TYPE_ORTHOGRAPHIC;
SCENE_TEST.camera.nearClip = -1.0f;
SCENE_TEST.camera.farClip = 2.0f;
SCENE_TEST.camera.viewType = CAMERA_VIEW_TYPE_2D;
SCENE_TEST.camera._2d.zoom = 2.0f;
SCENE_TEST.camera._2d.position[0] = -150.0f;
SCENE_TEST.camera._2d.position[1] = -50.0f;
scene_t *scene = &SCENE_MANAGER_SCENES[SCENE_TYPE_TEST];
scene->flags |= SCENE_FLAG_ACTIVE | SCENE_FLAG_VISIBLE;
errorOk();
}
void sceneTestUpdate(void) {
}
void sceneTestRender(void) {
SCENE_TEST.camera.orthographic.left = 0.0f;
SCENE_TEST.camera.orthographic.right = frameBufferGetWidth(FRAMEBUFFER_BOUND);
SCENE_TEST.camera.orthographic.top = frameBufferGetHeight(FRAMEBUFFER_BOUND);
SCENE_TEST.camera.orthographic.bottom = 0.0f;
cameraPushMatrix(&SCENE_TEST.camera);
spriteBatchClear();
spriteBatchFlush();
cameraPopMatrix();
}
void sceneTestDispose(void) {
}

View File

@@ -0,0 +1,36 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "display/camera.h"
#include "error/error.h"
typedef struct {
camera_t camera;
} scenetest_t;
extern scenetest_t SCENE_TEST;
/**
* Initialize the test scene.
*/
errorret_t sceneTestInit(void);
/**
* Update the test scene.
*/
void sceneTestUpdate(void);
/**
* Render the test scene.
*/
void sceneTestRender(void);
/**
* Dispose of the test scene.
*/
void sceneTestDispose(void);