浏览代码

Merge pull request #5132 from maiconpintoabreu/fix-examples

[examples][core] refactoring core_input_mouse.c to use IsCursorHidden function for consistency
pull/5137/head
Ray 1 个月前
committed by GitHub
父节点
当前提交
0aa5e8169d
找不到此签名对应的密钥 GPG 密钥 ID: B5690EEEBB952194
共有 1 个文件被更改,包括 4 次插入7 次删除
  1. +4
    -7
      examples/core/core_input_mouse.c

+ 4
- 7
examples/core/core_input_mouse.c 查看文件

@ -29,7 +29,6 @@ int main(void)
Vector2 ballPosition = { -100.0f, -100.0f }; Vector2 ballPosition = { -100.0f, -100.0f };
Color ballColor = DARKBLUE; Color ballColor = DARKBLUE;
int isCursorHidden = 0;
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
@ -41,15 +40,13 @@ int main(void)
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
if (IsKeyPressed(KEY_H)) if (IsKeyPressed(KEY_H))
{ {
if (isCursorHidden == 0)
if (IsCursorHidden())
{ {
HideCursor();
isCursorHidden = 1;
ShowCursor();
} }
else else
{ {
ShowCursor();
isCursorHidden = 0;
HideCursor();
} }
} }
@ -75,7 +72,7 @@ int main(void)
DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, DARKGRAY); DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, DARKGRAY);
DrawText("Press 'H' to toggle cursor visibility", 10, 30, 20, DARKGRAY); DrawText("Press 'H' to toggle cursor visibility", 10, 30, 20, DARKGRAY);
if (n">isCursorHidden == 1) DrawText("CURSOR HIDDEN", 20, 60, 20, RED);
if (o">!IsCursorHidden()) DrawText("CURSOR HIDDEN", 20, 60, 20, RED);
else DrawText("CURSOR VISIBLE", 20, 60, 20, LIME); else DrawText("CURSOR VISIBLE", 20, 60, 20, LIME);
EndDrawing(); EndDrawing();

正在加载...
取消
保存