[rcore] Fix IsMouseButtonUp()
and add touch events for PLATFORM_DESKTOP_SDL
(#3610)
* Fix IsMouseButtonUp() and add touch events for PLATFORM_DESKTOP_SDL * Fix coding convention
This commit is contained in:
parent
8b33d1eeb9
commit
ab9bddb3bd
@ -1138,6 +1138,7 @@ void PollInputEvents(void)
|
||||
else if (btn == 1) btn = 2;
|
||||
|
||||
CORE.Input.Mouse.currentButtonState[btn] = 1;
|
||||
CORE.Input.Touch.currentTouchState[btn] = 1;
|
||||
|
||||
touchAction = 1;
|
||||
gestureUpdate = true;
|
||||
@ -1151,6 +1152,7 @@ void PollInputEvents(void)
|
||||
else if (btn == 1) btn = 2;
|
||||
|
||||
CORE.Input.Mouse.currentButtonState[btn] = 0;
|
||||
CORE.Input.Touch.currentTouchState[btn] = 0;
|
||||
|
||||
touchAction = 0;
|
||||
gestureUpdate = true;
|
||||
@ -1179,6 +1181,31 @@ void PollInputEvents(void)
|
||||
gestureUpdate = true;
|
||||
} break;
|
||||
|
||||
// Check touch events
|
||||
// NOTE: These cases need to be reviewed on a real touch screen
|
||||
case SDL_FINGERDOWN:
|
||||
{
|
||||
CORE.Input.Touch.currentTouchState[event.tfinger.fingerId] = 1;
|
||||
|
||||
touchAction = 1;
|
||||
gestureUpdate = true;
|
||||
} break;
|
||||
case SDL_FINGERUP:
|
||||
{
|
||||
CORE.Input.Touch.currentTouchState[event.tfinger.fingerId] = 0;
|
||||
|
||||
touchAction = 0;
|
||||
gestureUpdate = true;
|
||||
} break;
|
||||
case SDL_FINGERMOTION:
|
||||
{
|
||||
CORE.Input.Touch.position[event.tfinger.fingerId].x = (float)event.motion.x;
|
||||
CORE.Input.Touch.position[event.tfinger.fingerId].y = (float)event.motion.y;
|
||||
|
||||
touchAction = 2;
|
||||
gestureUpdate = true;
|
||||
} break;
|
||||
|
||||
// Check gamepad events
|
||||
case SDL_JOYAXISMOTION:
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user