Skip to content

Commit 70a06f9

Browse files
committed
use FLAG_* macros where possible
1 parent 2a29521 commit 70a06f9

File tree

8 files changed

+340
-362
lines changed

8 files changed

+340
-362
lines changed

src/platforms/rcore_android.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -769,10 +769,10 @@ int InitPlatform(void)
769769
//AConfiguration_getScreenLong(platform.app->config);
770770

771771
// Set some default window flags
772-
CORE.Window.flags &= ~FLAG_WINDOW_HIDDEN; // false
773-
CORE.Window.flags &= ~FLAG_WINDOW_MINIMIZED; // false
774-
CORE.Window.flags |= FLAG_WINDOW_MAXIMIZED; // true
775-
CORE.Window.flags &= ~FLAG_WINDOW_UNFOCUSED; // false
772+
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_HIDDEN); // false
773+
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_MINIMIZED); // false
774+
FLAG_SET(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED); // true
775+
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED); // false
776776
//----------------------------------------------------------------------------
777777

778778
// Initialize App command system
@@ -856,11 +856,11 @@ void ClosePlatform(void)
856856
static int InitGraphicsDevice(void)
857857
{
858858
CORE.Window.fullscreen = true;
859-
CORE.Window.flags |= FLAG_FULLSCREEN_MODE;
859+
FLAG_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
860860

861861
EGLint samples = 0;
862862
EGLint sampleBuffer = 0;
863-
if (CORE.Window.flags & FLAG_MSAA_4X_HINT)
863+
if (FLAG_CHECK(CORE.Window.flags, FLAG_MSAA_4X_HINT) > 0)
864864
{
865865
samples = 4;
866866
sampleBuffer = 1;
@@ -965,7 +965,7 @@ static int InitGraphicsDevice(void)
965965

966966
CORE.Window.ready = true;
967967

968-
if ((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) > 0) MinimizeWindow();
968+
if (FLAG_CHECK(CORE.Window.flags, FLAG_WINDOW_MINIMIZED) > 0) MinimizeWindow();
969969

970970
return 0;
971971
}
@@ -1032,7 +1032,7 @@ static void AndroidCommandCallback(struct android_app *app, int32_t cmd)
10321032
// Set font white rectangle for shapes drawing, so shapes and text can be batched together
10331033
// WARNING: rshapes module is required, if not available, default internal white rectangle is used
10341034
Rectangle rec = GetFontDefault().recs[95];
1035-
if (CORE.Window.flags & FLAG_MSAA_4X_HINT)
1035+
if (FLAG_CHECK(CORE.Window.flags, FLAG_MSAA_4X_HINT) > 0)
10361036
{
10371037
// NOTE: We try to maxime rec padding to avoid pixel bleeding on MSAA filtering
10381038
SetShapesTexture(GetFontDefault().texture, (Rectangle){ rec.x + 2, rec.y + 2, 1, 1 });
@@ -1075,14 +1075,14 @@ static void AndroidCommandCallback(struct android_app *app, int32_t cmd)
10751075
case APP_CMD_GAINED_FOCUS:
10761076
{
10771077
platform.appEnabled = true;
1078-
CORE.Window.flags &= ~FLAG_WINDOW_UNFOCUSED;
1078+
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED);
10791079
//ResumeMusicStream();
10801080
} break;
10811081
case APP_CMD_PAUSE: break;
10821082
case APP_CMD_LOST_FOCUS:
10831083
{
10841084
platform.appEnabled = false;
1085-
CORE.Window.flags |= FLAG_WINDOW_UNFOCUSED;
1085+
FLAG_SET(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED);
10861086
//PauseMusicStream();
10871087
} break;
10881088
case APP_CMD_TERM_WINDOW:
@@ -1160,8 +1160,8 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event)
11601160

11611161
if (type == AINPUT_EVENT_TYPE_MOTION)
11621162
{
1163-
if (((source & AINPUT_SOURCE_JOYSTICK) == AINPUT_SOURCE_JOYSTICK) ||
1164-
((source & AINPUT_SOURCE_GAMEPAD) == AINPUT_SOURCE_GAMEPAD))
1163+
if ((FLAG_CHECK(source, AINPUT_SOURCE_JOYSTICK) == AINPUT_SOURCE_JOYSTICK) ||
1164+
(FLAG_CHECK(source, AINPUT_SOURCE_GAMEPAD) == AINPUT_SOURCE_GAMEPAD))
11651165
{
11661166
// For now we'll assume a single gamepad which we "detect" on its input event
11671167
CORE.Input.Gamepad.ready[0] = true;
@@ -1224,8 +1224,8 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event)
12241224
//int32_t AKeyEvent_getMetaState(event);
12251225

12261226
// Handle gamepad button presses and releases
1227-
if (((source & AINPUT_SOURCE_JOYSTICK) == AINPUT_SOURCE_JOYSTICK) ||
1228-
((source & AINPUT_SOURCE_GAMEPAD) == AINPUT_SOURCE_GAMEPAD))
1227+
if ((FLAG_CHECK(source, AINPUT_SOURCE_JOYSTICK) == AINPUT_SOURCE_JOYSTICK) ||
1228+
(FLAG_CHECK(source, AINPUT_SOURCE_GAMEPAD) == AINPUT_SOURCE_GAMEPAD))
12291229
{
12301230
// For now we'll assume a single gamepad which we "detect" on its input event
12311231
CORE.Input.Gamepad.ready[0] = true;

src/platforms/rcore_desktop_glfw.c

Lines changed: 83 additions & 83 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)