@@ -427,7 +427,6 @@ static pthread_t gamepadThreadId; // Gamepad reading thread id
427427static char gamepadName [64 ]; // Gamepad name holder
428428#endif
429429
430- bool touchDetected = false;
431430//-----------------------------------------------------------------------------------
432431
433432// Timming system variables
@@ -2441,16 +2440,11 @@ bool IsMouseButtonPressed(int button)
24412440{
24422441 bool pressed = false;
24432442
2444- // TODO: Review, gestures could be not supported despite being on Android platform!
24452443#if defined(PLATFORM_ANDROID )
24462444 if (IsGestureDetected (GESTURE_TAP )) pressed = true;
24472445#else
2448- if ((currentMouseState [button ] != previousMouseState [button ]) && (currentMouseState [button ] == 1 )) pressed = true;
2449- #endif
2450-
2451-
2452- #if defined(PLATFORM_WEB )
2453- if (IsTouchDetected ()) pressed = true; // There was a touch!
2446+ // NOTE: On PLATFORM_DESKTOP and PLATFORM_WEB IsMouseButtonPressed() is equivalent to GESTURE_TAP
2447+ if (((currentMouseState [button ] != previousMouseState [button ]) && (currentMouseState [button ] == 1 )) || IsGestureDetected (GESTURE_TAP )) pressed = true;
24542448#endif
24552449
24562450 return pressed ;
@@ -2464,7 +2458,8 @@ bool IsMouseButtonDown(int button)
24642458#if defined(PLATFORM_ANDROID )
24652459 if (IsGestureDetected (GESTURE_HOLD )) down = true;
24662460#else
2467- if (GetMouseButtonStatus (button ) == 1 ) down = true;
2461+ // NOTE: On PLATFORM_DESKTOP and PLATFORM_WEB IsMouseButtonDown() is equivalent to GESTURE_HOLD or GESTURE_DRAG
2462+ if ((GetMouseButtonStatus (button ) == 1 ) || IsGestureDetected (GESTURE_HOLD ) || IsGestureDetected (GESTURE_DRAG )) down = true;
24682463#endif
24692464
24702465 return down ;
@@ -2519,16 +2514,12 @@ Vector2 GetMousePosition(void)
25192514{
25202515 Vector2 position = { 0.0f , 0.0f };
25212516
2522- #if defined(PLATFORM_ANDROID )
2517+ #if defined(PLATFORM_ANDROID ) || defined( PLATFORM_WEB )
25232518 position = GetTouchPosition (0 );
25242519#else
25252520 position = (Vector2 ){ (mousePosition .x + mouseOffset .x )* mouseScale .x , (mousePosition .y + mouseOffset .y )* mouseScale .y };
25262521#endif
25272522
2528- #if defined(PLATFORM_WEB )
2529- if (IsTouchDetected ()) position = GetTouchPosition (0 );
2530- #endif
2531-
25322523 return position ;
25332524}
25342525
@@ -2575,16 +2566,6 @@ int GetMouseWheelMove(void)
25752566#endif
25762567}
25772568
2578- // Detect if a touch has happened
2579- bool IsTouchDetected (void )
2580- {
2581- #if defined(PLATFORM_ANDROID ) || defined(PLATFORM_WEB )
2582- return touchDetected ;
2583- #else // PLATFORM_DESKTOP, PLATFORM_RPI
2584- return false;
2585- #endif
2586- }
2587-
25882569// Returns touch position X for touch point 0 (relative to screen size)
25892570int GetTouchX (void )
25902571{
@@ -2627,14 +2608,12 @@ Vector2 GetTouchPosition(int index)
26272608 position .y = position .y * ((float )renderHeight /(float )displayHeight ) - renderOffsetY /2 ;
26282609 }
26292610 #endif
2630- #elif defined( PLATFORM_RPI )
2631-
2611+ #endif
2612+ #if defined( PLATFORM_RPI )
26322613 position = touchPosition [index ];
2633-
2634- #else // PLATFORM_DESKTOP
2635-
2614+ #endif
2615+ #if defined(PLATFORM_DESKTOP )
26362616 // TODO: GLFW is not supporting multi-touch input just yet
2637-
26382617 // https://www.codeproject.com/Articles/668404/Programming-for-Multi-Touch
26392618 // https://docs.microsoft.com/en-us/windows/win32/wintouch/getting-started-with-multi-touch-messages
26402619
@@ -3745,8 +3724,6 @@ static void PollInputEvents(void)
37453724
37463725 previousMouseWheelY = currentMouseWheelY ;
37473726 currentMouseWheelY = 0 ;
3748-
3749- touchDetected = false;
37503727#endif
37513728
37523729#if defined(PLATFORM_DESKTOP )
@@ -4393,8 +4370,6 @@ static EM_BOOL EmscriptenMouseCallback(int eventType, const EmscriptenMouseEvent
43934370// Register touch input events
43944371static EM_BOOL EmscriptenTouchCallback (int eventType , const EmscriptenTouchEvent * touchEvent , void * userData )
43954372{
4396- touchDetected = true;
4397-
43984373#if defined(SUPPORT_GESTURES_SYSTEM )
43994374 GestureEvent gestureEvent ;
44004375
0 commit comments