Skip to content

Conversation

JohnnyCena123
Copy link
Contributor

No description provided.

@raysan5 raysan5 changed the title use FLAG_* macros where possible [rcore] Use FLAG_* macros where possible Sep 4, 2025
@raysan5
Copy link
Owner

raysan5 commented Oct 1, 2025

@JohnnyCena123 I've been thinking about this update and I'm merging it but I'm concerned about the macro FLAG_CHECK(), I think it's not clear enough and when implemented it could lead to confusions. I think it could be replaced by FLAG_IS_SET() macro, checking directly if the requested flag is set (or not).

So, code needs to be updated from:

if (FLAG_CHECK(CORE.Window.flags, FLAG_WINDOW_MINIMIZED) > 0) { }

to

if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MINIMIZED)) { }

or depending the case

if (!FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MINIMIZED)) { }

Please, could you review it?

@raysan5
Copy link
Owner

raysan5 commented Oct 7, 2025

@JohnnyCena123 Did you see my previous message? I can implement it if you can't.

@JohnnyCena123
Copy link
Contributor Author

@JohnnyCena123 Did you saw my previous message? I can implement it if you can't.

sorry, I must've missed it. I will do that tomorrow if I remember

@JohnnyCena123
Copy link
Contributor Author

@raysan5 i remembered!

{
RGFW_window_setFloating(platform.window, RGFW_TRUE);
}
if (flags & FLAG_WINDOW_ALWAYS_RUN)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this check removed?

{
RGFW_window_setFloating(platform.window, RGFW_FALSE);
}
if (flags & FLAG_WINDOW_ALWAYS_RUN)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this check removed?

if (!FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_RESIZABLE)) FLAG_SET(flags, RGFW_windowNoResize);
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_TRANSPARENT)) FLAG_SET(flags, RGFW_windowTransparent);
if (FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE)) FLAG_SET(flags, RGFW_windowFullscreen);
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIDDEN)) FLAG_SET(flags, RGFW_windowHide);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, I prefer to avoid this kind of alignments, one space after the condition is ok.

{
SDL_SetWindowAlwaysOnTop(platform.window, SDL_FALSE);
}
if (flags & FLAG_WINDOW_ALWAYS_RUN)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this check removed?

{
SDL_SetWindowAlwaysOnTop(platform.window, SDL_FALSE);
}
if (flags & FLAG_WINDOW_ALWAYS_RUN)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this check removed?

CORE.Window.resizedLastFrame = false;

if ((CORE.Window.eventWaiting) || (((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) > 0) && ((CORE.Window.flags & FLAG_WINDOW_ALWAYS_RUN) == 0)))
if ((CORE.Window.eventWaiting) || FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MINIMIZED) && !FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_ALWAYS_RUN))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Second conditions must be between brakets!

if ((CORE.Window.flags & FLAG_WINDOW_UNFOCUSED) > 0)
//if (!FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIDDEN)) FLAG_SET(flags, SDL_WINDOW_HIDDEN);
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_UNDECORATED)) FLAG_SET(flags, SDL_WINDOW_BORDERLESS);
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_RESIZABLE)) FLAG_SET(flags, SDL_WINDOW_RESIZABLE);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, avoid alignment.

FLAG_CLEAR(flags, SDL_WINDOW_INPUT_FOCUS);
FLAG_CLEAR(flags, SDL_WINDOW_MOUSE_FOCUS);
}
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_TOPMOST)) FLAG_SET(flags, SDL_WINDOW_ALWAYS_ON_TOP);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, avoid alignment

}

const bool allowInterlaced = CORE.Window.flags & FLAG_INTERLACED_HINT;
const bool allowInterlaced = FLAG_IS_SET(CORE.Window.flags. FLAG_INTERLACED_HINT);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This point seems it must be a comma.

@raysan5
Copy link
Owner

raysan5 commented Oct 16, 2025

@JohnnyCena123 Added some code reviews. Did you test the changes? There is a windows_config_flags example to test some of them...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants