Fix touch screen flip

This commit is contained in:
elasota
2020-10-14 18:26:13 -04:00
parent b682004f29
commit 64ce75caa8

View File

@@ -344,6 +344,9 @@ void GetInput (gliderPtr thisGlider)
if (thisMac.isTouchscreen)
{
bool touchLeftState = false;
bool touchRightState = false;
for (int fi = 0; fi < touchScreenControlState::kMaxFingers; fi++)
{
const touchScreenFingerState &fstate = touchScreen.fingers[fi];
@@ -360,21 +363,10 @@ void GetInput (gliderPtr thisGlider)
case TouchScreenCtrlIDs::Movement:
{
int32_t screenWidth = mainWindowRect.Width();
const bool touchLeftState = (touchScreenPoint.h * 2 <= screenWidth);
const bool touchRightState = (touchScreenPoint.h * 2 - screenWidth >= 0);
if (touchLeftState)
{
if (touchRightState)
continuousFlipState = true;
else
leftState = true;
}
else
{
if (touchRightState)
rightState = true;
}
if (touchScreenPoint.h * 2 <= screenWidth)
touchLeftState = true;
if (touchScreenPoint.h * 2 - screenWidth >= 0)
touchRightState = true;
}
break;
case TouchScreenCtrlIDs::Flip:
@@ -390,6 +382,16 @@ void GetInput (gliderPtr thisGlider)
break;
}
}
if (touchLeftState)
{
if (touchRightState)
continuousFlipState = true;
else
leftState = true;
}
else if (touchRightState)
rightState = true;
}
if (theKeys->IsSet(thisGlider->gamepadRightKey))