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!

{
if ((FLAG_CHECK(source, AINPUT_SOURCE_JOYSTICK) == AINPUT_SOURCE_JOYSTICK) ||
(FLAG_CHECK(source, AINPUT_SOURCE_GAMEPAD) == AINPUT_SOURCE_GAMEPAD))
if ((FLAG_IS_SET(source, AINPUT_SOURCE_JOYSTICK) == AINPUT_SOURCE_JOYSTICK) ||
Copy link
Owner

Choose a reason for hiding this comment

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

Is it needed the extra == check if we already check for the flag set?

// Handle gamepad button presses and releases
if ((FLAG_CHECK(source, AINPUT_SOURCE_JOYSTICK) == AINPUT_SOURCE_JOYSTICK) ||
(FLAG_CHECK(source, AINPUT_SOURCE_GAMEPAD) == AINPUT_SOURCE_GAMEPAD))
if ((FLAG_IS_SET(source, AINPUT_SOURCE_JOYSTICK) == AINPUT_SOURCE_JOYSTICK) ||
Copy link
Owner

Choose a reason for hiding this comment

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

Is it needed the extra == check if we already check for the flag set?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i probably missed that, i only searched for == 0

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