From 694190ea12ab84b71e98b276fb810d49c2872dd6 Mon Sep 17 00:00:00 2001 From: ubkp <118854183+ubkp@users.noreply.github.com> Date: Fri, 22 Sep 2023 16:35:47 -0300 Subject: [PATCH] Move SetMouseCursor from rcore to android, desktop, web --- src/rcore.c | 28 ++++++++++++++-------------- src/rcore_android.c | 7 +++++++ src/rcore_desktop.c | 13 +++++++++++++ src/rcore_web.c | 8 +++++++- 4 files changed, 41 insertions(+), 15 deletions(-) diff --git a/src/rcore.c b/src/rcore.c index 0031a885c..a5bd8839a 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -2106,20 +2106,20 @@ Vector2 GetMouseWheelMoveV(void) return result; } -// Set mouse cursor -// NOTE: This is a no-op on platforms other than PLATFORM_DESKTOP -void SetMouseCursor(int cursor) -{ -#if defined(PLATFORM_DESKTOP) - CORE.Input.Mouse.cursor = cursor; - if (cursor == MOUSE_CURSOR_DEFAULT) glfwSetCursor(CORE.Window.handle, NULL); - else - { - // NOTE: We are relating internal GLFW enum values to our MouseCursor enum values - glfwSetCursor(CORE.Window.handle, glfwCreateStandardCursor(0x00036000 + cursor)); - } -#endif -} +//// Set mouse cursor +//// NOTE: This is a no-op on platforms other than PLATFORM_DESKTOP +//void SetMouseCursor(int cursor) +//{ +//#if defined(PLATFORM_DESKTOP) +// CORE.Input.Mouse.cursor = cursor; +// if (cursor == MOUSE_CURSOR_DEFAULT) glfwSetCursor(CORE.Window.handle, NULL); +// else +// { +// // NOTE: We are relating internal GLFW enum values to our MouseCursor enum values +// glfwSetCursor(CORE.Window.handle, glfwCreateStandardCursor(0x00036000 + cursor)); +// } +//#endif +//} //// Get touch position X for touch point 0 (relative to screen size) //int GetTouchX(void) diff --git a/src/rcore_android.c b/src/rcore_android.c index 5a5f657ba..cb9472ffa 100644 --- a/src/rcore_android.c +++ b/src/rcore_android.c @@ -1683,6 +1683,13 @@ float GetMouseWheelMove(void) return 0.0f; } +// Set mouse cursor +// NOTE: This is a no-op on platforms other than PLATFORM_DESKTOP +void SetMouseCursor(int cursor) +{ + TRACELOG(LOG_INFO, "SetMouseCursor not implemented in rcore_android.c"); +} + // Get touch position X for touch point 0 (relative to screen size) int GetTouchX(void) { diff --git a/src/rcore_desktop.c b/src/rcore_desktop.c index 6d0ee18c6..6658f04db 100644 --- a/src/rcore_desktop.c +++ b/src/rcore_desktop.c @@ -1579,6 +1579,19 @@ float GetMouseWheelMove(void) return result; } +// Set mouse cursor +// NOTE: This is a no-op on platforms other than PLATFORM_DESKTOP +void SetMouseCursor(int cursor) +{ + CORE.Input.Mouse.cursor = cursor; + if (cursor == MOUSE_CURSOR_DEFAULT) glfwSetCursor(CORE.Window.handle, NULL); + else + { + // NOTE: We are relating internal GLFW enum values to our MouseCursor enum values + glfwSetCursor(CORE.Window.handle, glfwCreateStandardCursor(0x00036000 + cursor)); + } +} + // Get touch position X for touch point 0 (relative to screen size) int GetTouchX(void) { diff --git a/src/rcore_web.c b/src/rcore_web.c index fab16ef4d..d6015aea7 100644 --- a/src/rcore_web.c +++ b/src/rcore_web.c @@ -1099,7 +1099,6 @@ void SetMousePosition(int x, int y) glfwSetCursorPos(CORE.Window.handle, CORE.Input.Mouse.currentPosition.x, CORE.Input.Mouse.currentPosition.y); } - // Get mouse wheel movement Y float GetMouseWheelMove(void) { @@ -1111,6 +1110,13 @@ float GetMouseWheelMove(void) return result; } +// Set mouse cursor +// NOTE: This is a no-op on platforms other than PLATFORM_DESKTOP +void SetMouseCursor(int cursor) +{ + TRACELOG(LOG_INFO, "SetMouseCursor not implemented in rcore_web.c"); +} + // Get touch position X for touch point 0 (relative to screen size) int GetTouchX(void) {