diff options
| author | Ray <[email protected]> | 2023-10-11 11:36:44 +0200 |
|---|---|---|
| committer | Ray <[email protected]> | 2023-10-11 11:36:44 +0200 |
| commit | 0d175a69ae1e7072e05587b5f7505bac0c07b4ce (patch) | |
| tree | 22fd3a8073105e223d76beb6980a806e13e6ed65 /src/rcore_android.c | |
| parent | 6ebfec99c50ef0b00bb693ac25ddebc01457153a (diff) | |
| download | raylib-0d175a69ae1e7072e05587b5f7505bac0c07b4ce.tar.gz raylib-0d175a69ae1e7072e05587b5f7505bac0c07b4ce.zip | |
REVIEWED: Mouse and Touch functions generic to all platforms #3313
Diffstat (limited to 'src/rcore_android.c')
| -rw-r--r-- | src/rcore_android.c | 53 |
1 files changed, 4 insertions, 49 deletions
diff --git a/src/rcore_android.c b/src/rcore_android.c index d9f72894..1921ed79 100644 --- a/src/rcore_android.c +++ b/src/rcore_android.c @@ -642,24 +642,6 @@ int SetGamepadMappings(const char *mappings) return 0; } -// Get mouse position X -int GetMouseX(void) -{ - return (int)CORE.Input.Touch.position[0].x; -} - -// Get mouse position Y -int GetMouseY(void) -{ - return (int)CORE.Input.Touch.position[0].y; -} - -// Get mouse position XY -Vector2 GetMousePosition(void) -{ - return GetTouchPosition(0); -} - // Set mouse position XY void SetMousePosition(int x, int y) { @@ -667,43 +649,12 @@ void SetMousePosition(int x, int y) CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition; } -// Get mouse wheel movement Y -float GetMouseWheelMove(void) -{ - TRACELOG(LOG_WARNING, "GetMouseWheelMove() not implemented on target platform"); - return 0.0f; -} - // Set mouse cursor void SetMouseCursor(int cursor) { TRACELOG(LOG_WARNING, "SetMouseCursor() not implemented on target platform"); } -// Get touch position X for touch point 0 (relative to screen size) -int GetTouchX(void) -{ - return (int)CORE.Input.Touch.position[0].x; -} - -// Get touch position Y for touch point 0 (relative to screen size) -int GetTouchY(void) -{ - return (int)CORE.Input.Touch.position[0].y; -} - -// 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 }; - - if (index < MAX_TOUCH_POINTS) position = CORE.Input.Touch.position[index]; - else TRACELOG(LOG_WARNING, "INPUT: Required touch point out of range (Max touch points: %i)", MAX_TOUCH_POINTS); - - return position; -} - // Register all input events void PollInputEvents(void) { @@ -1247,6 +1198,10 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event) if (CORE.Input.Touch.pointCount > 0) CORE.Input.Touch.currentTouchState[MOUSE_BUTTON_LEFT] = 1; else CORE.Input.Touch.currentTouchState[MOUSE_BUTTON_LEFT] = 0; + + // Map touch[0] as mouse input for convenience + CORE.Input.Mouse.currentPosition = CORE.Input.Touch.position[0]; + CORE.Input.Mouse.currentWheelMove = (Vector2){ 0.0f, 0.0f }; return 0; } |
