Skip to content

Commit 73030e0

Browse files
authored
Merge pull request #4895 from AndrewHamel111/descriptive-window-flag-warning
Add Warning to direct users to appropriate WindowState / ConfigFlag function
2 parents cf1713e + fdb92b3 commit 73030e0

File tree

5 files changed

+10
-0
lines changed

5 files changed

+10
-0
lines changed

src/platforms/rcore_desktop_glfw.c

+2
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,8 @@ void RestoreWindow(void)
307307
// Set window configuration state using flags
308308
void SetWindowState(unsigned int flags)
309309
{
310+
if (!CORE.Window.ready) TRACELOG(LOG_WARNING, "WINDOW: SetWindowState does nothing before window initialization, Use \"SetConfigFlags\" instead");
311+
310312
// Check previous state and requested state to apply required changes
311313
// NOTE: In most cases the functions already change the flags internally
312314

src/platforms/rcore_desktop_rgfw.c

+2
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,8 @@ void RestoreWindow(void)
350350
// Set window configuration state using flags
351351
void SetWindowState(unsigned int flags)
352352
{
353+
if (!CORE.Window.ready) TRACELOG(LOG_WARNING, "WINDOW: SetWindowState does nothing before window initialization, Use \"SetConfigFlags\" instead");
354+
353355
CORE.Window.flags |= flags;
354356

355357
if (flags & FLAG_VSYNC_HINT)

src/platforms/rcore_desktop_sdl.c

+2
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,8 @@ void RestoreWindow(void)
518518
// Set window configuration state using flags
519519
void SetWindowState(unsigned int flags)
520520
{
521+
if (!CORE.Window.ready) TRACELOG(LOG_WARNING, "WINDOW: SetWindowState does nothing before window initialization, Use \"SetConfigFlags\" instead");
522+
521523
CORE.Window.flags |= flags;
522524

523525
if (flags & FLAG_VSYNC_HINT)

src/platforms/rcore_web.c

+2
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,8 @@ void RestoreWindow(void)
364364
// Set window configuration state using flags
365365
void SetWindowState(unsigned int flags)
366366
{
367+
if (!CORE.Window.ready) TRACELOG(LOG_WARNING, "WINDOW: SetWindowState does nothing before window initialization, Use \"SetConfigFlags\" instead");
368+
367369
// Check previous state and requested state to apply required changes
368370
// NOTE: In most cases the functions already change the flags internally
369371

src/rcore.c

+2
Original file line numberDiff line numberDiff line change
@@ -1905,6 +1905,8 @@ void TakeScreenshot(const char *fileName)
19051905
// To configure window states after creation, just use SetWindowState()
19061906
void SetConfigFlags(unsigned int flags)
19071907
{
1908+
if (CORE.Window.ready) TRACELOG(LOG_WARNING, "WINDOW: SetConfigFlags called after window initialization, Use \"SetWindowState\" to set flags instead");
1909+
19081910
// Selected flags are set but not evaluated at this point,
19091911
// flag evaluation happens at InitWindow() or SetWindowState()
19101912
CORE.Window.flags |= flags;

0 commit comments

Comments
 (0)