mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-01-23 15:31:16 +00:00
Update legoinputmanager.cpp
This commit is contained in:
parent
797aac1410
commit
bf354523ac
@ -617,25 +617,25 @@ MxBool LegoInputManager::HandleTouchEvent(SDL_Event* p_event, TouchScheme p_touc
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case e_gamepad: {
|
case e_gamepad: {
|
||||||
static SDL_FingerID finger = (SDL_FingerID) 0;
|
static SDL_FingerID g_finger = (SDL_FingerID) 0;
|
||||||
|
|
||||||
switch (p_event->type) {
|
switch (p_event->type) {
|
||||||
case SDL_EVENT_FINGER_DOWN:
|
case SDL_EVENT_FINGER_DOWN:
|
||||||
if (!finger) {
|
if (!g_finger) {
|
||||||
finger = event.fingerID;
|
g_finger = event.fingerID;
|
||||||
m_touchVirtualThumb = {0, 0};
|
m_touchVirtualThumb = {0, 0};
|
||||||
m_touchVirtualThumbOrigin = {event.x, event.y};
|
m_touchVirtualThumbOrigin = {event.x, event.y};
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_EVENT_FINGER_UP:
|
case SDL_EVENT_FINGER_UP:
|
||||||
if (event.fingerID == finger) {
|
if (event.fingerID == g_finger) {
|
||||||
finger = 0;
|
g_finger = 0;
|
||||||
m_touchVirtualThumb = {0, 0};
|
m_touchVirtualThumb = {0, 0};
|
||||||
m_touchVirtualThumbOrigin = {0, 0};
|
m_touchVirtualThumbOrigin = {0, 0};
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_EVENT_FINGER_MOTION:
|
case SDL_EVENT_FINGER_MOTION:
|
||||||
if (event.fingerID == finger) {
|
if (event.fingerID == g_finger) {
|
||||||
const float thumbstickRadius = 0.25f;
|
const float thumbstickRadius = 0.25f;
|
||||||
const float deltaX =
|
const float deltaX =
|
||||||
SDL_clamp(event.x - m_touchVirtualThumbOrigin.x, -thumbstickRadius, thumbstickRadius);
|
SDL_clamp(event.x - m_touchVirtualThumbOrigin.x, -thumbstickRadius, thumbstickRadius);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user