Skip to content

Commit 0aa5e81

Browse files
authored
Merge pull request #5132 from maiconpintoabreu/fix-examples
[examples][core] refactoring core_input_mouse.c to use IsCursorHidden function for consistency
2 parents 99cb82a + 238163c commit 0aa5e81

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

examples/core/core_input_mouse.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ int main(void)
2929

3030
Vector2 ballPosition = { -100.0f, -100.0f };
3131
Color ballColor = DARKBLUE;
32-
int isCursorHidden = 0;
3332

3433
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
3534
//---------------------------------------------------------------------------------------
@@ -41,15 +40,13 @@ int main(void)
4140
//----------------------------------------------------------------------------------
4241
if (IsKeyPressed(KEY_H))
4342
{
44-
if (isCursorHidden == 0)
43+
if (IsCursorHidden())
4544
{
46-
HideCursor();
47-
isCursorHidden = 1;
45+
ShowCursor();
4846
}
4947
else
5048
{
51-
ShowCursor();
52-
isCursorHidden = 0;
49+
HideCursor();
5350
}
5451
}
5552

@@ -75,7 +72,7 @@ int main(void)
7572
DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, DARKGRAY);
7673
DrawText("Press 'H' to toggle cursor visibility", 10, 30, 20, DARKGRAY);
7774

78-
if (isCursorHidden == 1) DrawText("CURSOR HIDDEN", 20, 60, 20, RED);
75+
if (!IsCursorHidden()) DrawText("CURSOR HIDDEN", 20, 60, 20, RED);
7976
else DrawText("CURSOR VISIBLE", 20, 60, 20, LIME);
8077

8178
EndDrawing();

0 commit comments

Comments
 (0)