This commit is contained in:
2025-08-21 22:58:39 -05:00
parent 1b4c270ccb
commit b1be1deb79
11 changed files with 223 additions and 55 deletions

View File

@@ -10,6 +10,9 @@ target_sources(${DUSK_TARGET_NAME}
camera.c
)
# Subdirectories
add_subdirectory(mesh)
if(DUSK_TARGET_SYSTEM STREQUAL "linux")
target_compile_definitions(${DUSK_TARGET_NAME}
PRIVATE

View File

@@ -14,6 +14,8 @@ typedef struct {
extern camera_t CAMERA_DATA[ECS_ENTITY_COUNT_MAX];
extern ecscomponent_t CAMERA_COMPONENT;
extern ecsid_t CAMERA_MAIN;
/**
* Initializes the camera component.

View File

@@ -8,8 +8,17 @@
#include "display/display.h"
#include "console/console.h"
#include "display/mesh/mesh.h"
display_t DISPLAY;
mesh_t mesh;
meshvertex_t triangle[3] = {
{{255, 0, 0, 255}, {0.0f, 0.0f}, {0.0f, 1.0f}}, // Vertex 1
{{0, 255, 0, 255}, {1.0f, 0.0f}, {1.0f, 1.0f}}, // Vertex 2
{{0, 0, 255, 255}, {0.5f, 1.0f}, {0.5f, 0.0f}} // Vertex 3
};
errorret_t displayInit(void) {
#if DUSK_DISPLAY_SDL2
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER) != 0) {
@@ -53,6 +62,8 @@ errorret_t displayInit(void) {
glEnableClientState(GL_VERTEX_ARRAY);
#endif
meshInit(&mesh, MESH_PRIMITIVE_TRIANGLES, 3, triangle);
// For now, we just return an OK error.
errorOk();
}
@@ -68,17 +79,22 @@ errorret_t displayUpdate(void) {
default:
break;
}
}
}
SDL_GL_SwapWindow(DISPLAY.window);
#endif
meshDraw(&mesh, 0, -1);
// For now, we just return an OK error.
errorOk();
}
errorret_t displayDispose(void) {
meshDispose(&mesh);
#if DUSK_DISPLAY_SDL2
if(DISPLAY.glContext) {
SDL_GL_DeleteContext(DISPLAY.glContext);

View File

@@ -4,7 +4,7 @@
// https://opensource.org/licenses/MIT
#pragma once
#include "display/render.h"
#include "display/display.h"
typedef enum {
#if DUSK_DISPLAY_SDL2