Added screen

This commit is contained in:
2025-09-12 15:56:21 -05:00
parent 9b98181d28
commit 067b0d2e9f
10 changed files with 264 additions and 110 deletions

View File

@@ -12,6 +12,7 @@
#include "display/spritebatch/spritebatch.h"
#include "display/ui/ui.h"
#include "display/mesh/quad.h"
#include "display/screen.h"
display_t DISPLAY;
@@ -68,6 +69,7 @@ errorret_t displayInit(void) {
spriteBatchInit();
errorChain(uiInit());
errorChain(sceneManagerInit());
screenInit();
errorOk();
}
@@ -85,24 +87,10 @@ errorret_t displayUpdate(void) {
break;
}
}
// TODO: move to framebuffer component
int32_t windowWidth, windowHeight;
#if PSP
windowWidth = DISPLAY_WINDOW_WIDTH_DEFAULT;
windowHeight = DISPLAY_WINDOW_HEIGHT_DEFAULT;
#else
SDL_GetWindowSize(DISPLAY.window, &windowWidth, &windowHeight);
#endif
glViewport(0, 0, windowWidth, windowHeight);
#endif
spriteBatchClear();
frameBufferBind(&FRAMEBUFFER_BACKBUFFER);
frameBufferClear(
FRAMEBUFFER_CLEAR_COLOR | FRAMEBUFFER_CLEAR_DEPTH,
COLOR_CORNFLOWER_BLUE
);
screenBind();
sceneManagerUpdate();
uiUpdate();
@@ -110,6 +98,8 @@ errorret_t displayUpdate(void) {
sceneManagerRender();
uiRender();
screenUnbindAndRender();
#if DISPLAY_SDL2
SDL_GL_SwapWindow(DISPLAY.window);
#endif
@@ -124,6 +114,7 @@ errorret_t displayUpdate(void) {
}
errorret_t displayDispose(void) {
screenDispose();
sceneManagerDispose();
uiDispose();
spriteBatchDispose();