Skip to content

Commit bca4f83

Browse files
authored
required change for ESP-IDF 6 (#5674)
1 parent 7fef65a commit bca4f83

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/external/rlsw.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,7 @@ SWAPI void swClear(uint32_t bitmask);
689689
SWAPI void swBlendFunc(SWfactor sfactor, SWfactor dfactor);
690690
SWAPI void swPolygonMode(SWpoly mode);
691691
SWAPI void swCullFace(SWface face);
692+
SWAPI void *swGetColorBuffer(int *width, int *height); // Restored for ESP-IDF compatibility
692693

693694
SWAPI void swPointSize(float size);
694695
SWAPI void swLineWidth(float width);
@@ -4200,6 +4201,15 @@ void swCullFace(SWface face)
42004201
RLSW.cullFace = face;
42014202
}
42024203

4204+
// Get direct pointer to the default framebuffer's pixel data
4205+
// Restored for ESP-IDF compatibility - removed in Raylib 6.0 PR #5655
4206+
void *swGetColorBuffer(int *width, int *height)
4207+
{
4208+
if (width) *width = RLSW.colorBuffer->width;
4209+
if (height) *height = RLSW.colorBuffer->height;
4210+
return RLSW.colorBuffer->pixels;
4211+
}
4212+
42034213
void swPointSize(float size)
42044214
{
42054215
RLSW.pointRadius = floorf(size*0.5f);

src/rcore.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,18 @@ void InitWindow(int width, int height, const char *title)
682682
TRACELOG(LOG_WARNING, "SYSTEM: Failed to initialize platform");
683683
return;
684684
}
685+
686+
// FIX: Initialize render dimensions for embedded platforms
687+
// On desktop platforms (GLFW, SDL, etc.), CORE.Window.render.width/height are
688+
// set during window creation. On embedded platforms with no window manager,
689+
// InitPlatform() doesn't set these values, so we initialize them here from
690+
// the screen dimensions (which are set from the InitWindow parameters).
691+
// This fix is required for embedded platforms.
692+
if (CORE.Window.render.width == 0 || CORE.Window.render.height == 0)
693+
{
694+
CORE.Window.render.width = CORE.Window.screen.width;
695+
CORE.Window.render.height = CORE.Window.screen.height;
696+
}
685697
//--------------------------------------------------------------
686698

687699
// Initialize rlgl default data (buffers and shaders)

0 commit comments

Comments
 (0)