This commit is contained in:
2025-10-06 16:30:44 -05:00
parent f3a6c8df71
commit 85434b4edb
2 changed files with 8 additions and 1 deletions

View File

@@ -61,6 +61,7 @@ void screenBind() {
case SCREEN_MODE_FIXED_SIZE: {
SCREEN.width = SCREEN.fixedSize.width;
SCREEN.height = SCREEN.fixedSize.height;
SCREEN.aspect = (float_t)SCREEN.width / (float_t)SCREEN.height;
if(SCREEN.framebufferReady) {
// Is current framebuffer the correct size?
@@ -96,6 +97,7 @@ void screenBind() {
// No need to use framebuffer.
SCREEN.width = fbWidth;
SCREEN.height = fbHeight;
SCREEN.aspect = (float_t)SCREEN.width / (float_t)SCREEN.height;
if(SCREEN.framebufferReady) {
frameBufferDispose(&SCREEN.framebuffer);
@@ -124,6 +126,7 @@ void screenBind() {
// Correct size, nothing to do.
SCREEN.width = newFbWidth;
SCREEN.height = newFbHeight;
SCREEN.aspect = (float_t)SCREEN.width / (float_t)SCREEN.height;
frameBufferBind(&SCREEN.framebuffer);
return;
}
@@ -135,9 +138,10 @@ void screenBind() {
// Create new framebuffer
frameBufferInit(&SCREEN.framebuffer, newFbWidth, newFbHeight);
SCREEN.framebufferReady = true;
SCREEN.width = newFbWidth;
SCREEN.height = newFbHeight;
SCREEN.aspect = (float_t)SCREEN.width / (float_t)SCREEN.height;
SCREEN.framebufferReady = true;
// Bind FB
frameBufferBind(&SCREEN.framebuffer);
@@ -155,6 +159,7 @@ void screenBind() {
SCREEN.width = newFbWidth;
SCREEN.height = newFbHeight;
SCREEN.aspect = (float_t)SCREEN.width / (float_t)SCREEN.height;
if(fbWidth == newFbWidth && fbHeight == newFbHeight) {
// No need to use framebuffer.
@@ -198,6 +203,7 @@ void screenBind() {
SCREEN.width = newFbWidth;
SCREEN.height = newFbHeight;
SCREEN.aspect = (float_t)SCREEN.width / (float_t)SCREEN.height;
if(fbWidth == newFbWidth && fbHeight == newFbHeight) {
// No need to use framebuffer.

View File

@@ -35,6 +35,7 @@ typedef struct {
// Calculated dimensions of the viewport, to be used by the camera
int32_t width;
int32_t height;
float_t aspect;
#if DISPLAY_SIZE_DYNAMIC == 1
framebuffer_t framebuffer;