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

@@ -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);