Events optimization
This commit is contained in:
parent
cd04bcdee1
commit
32b30517ce
|
|
@ -1186,10 +1186,10 @@ void PollInputEvents(void)
|
||||||
// NOTE: These cases need to be reviewed on a real touch screen
|
// NOTE: These cases need to be reviewed on a real touch screen
|
||||||
case SDL_FINGERDOWN:
|
case SDL_FINGERDOWN:
|
||||||
{
|
{
|
||||||
CORE.Input.Touch.currentTouchState[(int)event.tfinger.fingerId] = 1;
|
const int touchId = (int)event.tfinger.fingerId;
|
||||||
|
CORE.Input.Touch.currentTouchState[touchId] = 1;
|
||||||
CORE.Input.Touch.position[(int)event.tfinger.fingerId].x = event.tfinger.x * CORE.Window.screen.width;
|
CORE.Input.Touch.position[touchId].x = event.tfinger.x * CORE.Window.screen.width;
|
||||||
CORE.Input.Touch.position[(int)event.tfinger.fingerId].y = event.tfinger.y * CORE.Window.screen.height;
|
CORE.Input.Touch.position[touchId].y = event.tfinger.y * CORE.Window.screen.height;
|
||||||
|
|
||||||
touchAction = 1;
|
touchAction = 1;
|
||||||
gestureUpdate = true;
|
gestureUpdate = true;
|
||||||
|
|
@ -1197,10 +1197,10 @@ void PollInputEvents(void)
|
||||||
} break;
|
} break;
|
||||||
case SDL_FINGERUP:
|
case SDL_FINGERUP:
|
||||||
{
|
{
|
||||||
CORE.Input.Touch.currentTouchState[(int)event.tfinger.fingerId] = 0;
|
const int touchId = (int)event.tfinger.fingerId;
|
||||||
|
CORE.Input.Touch.currentTouchState[touchId] = 0;
|
||||||
CORE.Input.Touch.position[(int)event.tfinger.fingerId].x = event.tfinger.x * CORE.Window.screen.width;
|
CORE.Input.Touch.position[touchId].x = event.tfinger.x * CORE.Window.screen.width;
|
||||||
CORE.Input.Touch.position[(int)event.tfinger.fingerId].y = event.tfinger.y * CORE.Window.screen.height;
|
CORE.Input.Touch.position[touchId].y = event.tfinger.y * CORE.Window.screen.height;
|
||||||
|
|
||||||
touchAction = 0;
|
touchAction = 0;
|
||||||
gestureUpdate = true;
|
gestureUpdate = true;
|
||||||
|
|
@ -1208,8 +1208,9 @@ void PollInputEvents(void)
|
||||||
} break;
|
} break;
|
||||||
case SDL_FINGERMOTION:
|
case SDL_FINGERMOTION:
|
||||||
{
|
{
|
||||||
CORE.Input.Touch.position[(int)event.tfinger.fingerId].x = event.tfinger.x * CORE.Window.screen.width;
|
const int touchId = (int)event.tfinger.fingerId;
|
||||||
CORE.Input.Touch.position[(int)event.tfinger.fingerId].y = event.tfinger.y * CORE.Window.screen.height;
|
CORE.Input.Touch.position[touchId].x = event.tfinger.x * CORE.Window.screen.width;
|
||||||
|
CORE.Input.Touch.position[touchId].y = event.tfinger.y * CORE.Window.screen.height;
|
||||||
|
|
||||||
touchAction = 2;
|
touchAction = 2;
|
||||||
gestureUpdate = true;
|
gestureUpdate = true;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user