rename framebuffer to surface

This commit is contained in:
CrackedPixel 2026-04-17 00:13:11 -05:00
parent 08a944cb13
commit 2dca13d390

View File

@ -179,10 +179,10 @@ typedef struct {
mg_gamepads minigamepad; mg_gamepads minigamepad;
#if defined(GRAPHICS_API_OPENGL_SOFTWARE) #if defined(GRAPHICS_API_OPENGL_SOFTWARE)
RGFW_surface* framebuffer; RGFW_surface *surface;
u8* framebufferPixels; u8 *surfacePixels;
i32 framebufferWidth; i32 surfaceWidth;
i32 framebufferHeight; i32 surfaceHeight;
#endif #endif
} PlatformData; } PlatformData;
@ -1131,10 +1131,10 @@ void SwapScreenBuffer(void)
#if defined(GRAPHICS_API_OPENGL_SOFTWARE) #if defined(GRAPHICS_API_OPENGL_SOFTWARE)
{ {
// copy rlsw pixel data to the surface framebuffer // copy rlsw pixel data to the surface framebuffer
swReadPixels(0, 0, platform.framebufferWidth, platform.framebufferHeight, SW_RGBA, SW_BYTE, platform.framebufferPixels); swReadPixels(0, 0, platform.surfaceWidth, platform.surfaceHeight, SW_RGBA, SW_BYTE, platform.surfacePixels);
// blit surface to the window // blit surface to the window
RGFW_window_blitSurface(platform.window, platform.framebuffer); RGFW_window_blitSurface(platform.window, platform.surface);
} }
#else #else
{ {
@ -1385,28 +1385,28 @@ void PollInputEvents(void)
CORE.Window.resizedLastFrame = true; CORE.Window.resizedLastFrame = true;
#if defined(GRAPHICS_API_OPENGL_SOFTWARE) #if defined(GRAPHICS_API_OPENGL_SOFTWARE)
platform.framebufferWidth = CORE.Window.currentFbo.width; platform.surfaceWidth = CORE.Window.currentFbo.width;
platform.framebufferHeight = CORE.Window.currentFbo.height; platform.surfaceHeight = CORE.Window.currentFbo.height;
// in software mode we dont have the viewport so we need to reverse the highdpi changes // in software mode we dont have the viewport so we need to reverse the highdpi changes
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI)) if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI))
{ {
Vector2 scaleDpi = GetWindowScaleDPI(); Vector2 scaleDpi = GetWindowScaleDPI();
platform.framebufferWidth *= scaleDpi.x; platform.surfaceWidth *= scaleDpi.x;
platform.framebufferHeight *= scaleDpi.y; platform.surfaceHeight *= scaleDpi.y;
} }
if (platform.framebufferPixels != NULL) if (platform.surfacePixels != NULL)
{ {
RL_FREE(platform.framebufferPixels); RL_FREE(platform.surfacePixels);
platform.framebufferPixels = RL_MALLOC(platform.framebufferWidth * platform.framebufferHeight * 4); platform.surfacePixels = RL_MALLOC(platform.surfaceWidth * platform.surfaceHeight * 4);
} }
if (platform.framebuffer != NULL) if (platform.surface != NULL)
{ {
RGFW_surface_free(platform.framebuffer); RGFW_surface_free(platform.surface);
platform.framebuffer = RGFW_window_createSurface(platform.window, platform.framebufferPixels, platform.framebufferWidth, platform.framebufferHeight, RGFW_formatBGRA8); platform.surface = RGFW_window_createSurface(platform.window, platform.surfacePixels, platform.surfaceWidth, platform.surfaceHeight, RGFW_formatBGRA8);
swResize(platform.framebufferWidth, platform.framebufferHeight); swResize(platform.surfaceWidth, platform.surfaceHeight);
} }
#endif #endif
} break; } break;
@ -1743,10 +1743,10 @@ int InitPlatform(void)
RGFW_window_makeCurrentWindow_OpenGL(platform.window); RGFW_window_makeCurrentWindow_OpenGL(platform.window);
#if defined(GRAPHICS_API_OPENGL_SOFTWARE) #if defined(GRAPHICS_API_OPENGL_SOFTWARE)
platform.framebufferWidth = CORE.Window.currentFbo.width; platform.surfaceWidth = CORE.Window.currentFbo.width;
platform.framebufferHeight = CORE.Window.currentFbo.height; platform.surfaceHeight = CORE.Window.currentFbo.height;
platform.framebufferPixels = RL_MALLOC(platform.framebufferWidth * platform.framebufferHeight * 4); platform.surfacePixels = RL_MALLOC(platform.surfaceWidth * platform.surfaceHeight * 4);
platform.framebuffer = RGFW_window_createSurface(platform.window, platform.framebufferPixels, platform.framebufferWidth, platform.framebufferHeight, RGFW_formatBGRA8); platform.surface = RGFW_window_createSurface(platform.window, platform.surfacePixels, platform.surfaceWidth, platform.surfaceHeight, RGFW_formatBGRA8);
#endif #endif
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -1879,14 +1879,14 @@ void ClosePlatform(void)
mg_gamepads_free(&platform.minigamepad); mg_gamepads_free(&platform.minigamepad);
RGFW_window_close(platform.window); RGFW_window_close(platform.window);
if (platform.framebufferPixels != NULL) if (platform.surfacePixels != NULL)
{ {
RL_FREE(platform.framebufferPixels); RL_FREE(platform.surfacePixels);
} }
if (platform.framebuffer != NULL) if (platform.surface != NULL)
{ {
RGFW_surface_free(platform.framebuffer); RGFW_surface_free(platform.surface);
} }
} }