[split] rcore, web, desktop, android changes (batch 3) (#3338)

* First pass to remove unneeded platform macros for web

* Second pass to remove unneeded platform macros for web

* Move GetTouchX, GetTouchY, GetTouchPosition from rcore to web, desktop, android

* Move SetMouseCursor from rcore to android, desktop, web
This commit is contained in:
ubkp
2023-09-22 18:17:59 -03:00
committed by GitHub
parent 0ef3e09d7a
commit d5a780d4d1
4 changed files with 151 additions and 538 deletions

View File

@@ -1568,7 +1568,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)
{
@@ -1580,6 +1579,44 @@ 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)
{
return GetMouseX();
}
// Get touch position Y for touch point 0 (relative to screen size)
int GetTouchY(void)
{
return GetMouseY();
}
// Get touch position XY for a touch point index (relative to screen size)
// TODO: Touch position should be scaled depending on display size and render size
Vector2 GetTouchPosition(int index)
{
Vector2 position = { -1.0f, -1.0f };
// TODO: GLFW does not support multi-touch input just yet
// https://www.codeproject.com/Articles/668404/Programming-for-Multi-Touch
// https://docs.microsoft.com/en-us/windows/win32/wintouch/getting-started-with-multi-touch-messages
if (index == 0) position = GetMousePosition();
return position;
}
// Swap back buffer with front buffer (screen drawing)
void SwapScreenBuffer(void)
@@ -1587,7 +1624,6 @@ void SwapScreenBuffer(void)
glfwSwapBuffers(CORE.Window.handle);
}
// Register all input events
void PollInputEvents(void)
{