v2.3.0: one more crack at iOS gestures, think this one fixes everything

This commit is contained in:
Evan Debenham
2023-11-09 12:59:04 -05:00
parent f00acdc182
commit 9e59f6598a
2 changed files with 10 additions and 4 deletions
@@ -146,9 +146,11 @@ public class Game implements ApplicationListener {
} }
} }
//FIXME this is a hack to improve start times on android (first frame is 'cheated' and skips rendering) ///justResumed is used for two purposes:
//This is mainly to improve stats on google play, as lots of texture refreshing leads to slow warm starts //firstly, to clear pointer events when the game is resumed,
//Would be nice to accomplish this goal in a less hacky way // this helps with input errors caused by system gestures on iOS/Android
//secondly, as a bit of a hack to improve start time metrics on Android,
// as texture refreshing leads to slow warm starts. TODO would be nice to fix this properly
private boolean justResumed = true; private boolean justResumed = true;
@Override @Override
@@ -160,6 +162,7 @@ public class Game implements ApplicationListener {
} }
if (justResumed){ if (justResumed){
PointerEvent.clearPointerEvents();
justResumed = false; justResumed = false;
if (DeviceCompat.isAndroid()) return; if (DeviceCompat.isAndroid()) return;
} }
@@ -104,7 +104,10 @@ public class IOSLauncher extends IOSApplication.Delegate {
config.hideHomeIndicator = SPDSettings.fullscreen(); config.hideHomeIndicator = SPDSettings.fullscreen();
config.overrideRingerSwitch = SPDSettings.ignoreSilentMode(); config.overrideRingerSwitch = SPDSettings.ignoreSilentMode();
config.screenEdgesDeferringSystemGestures = UIRectEdge.None; //game has to ignore input from system gestures itself, otherwise there is lag on
//every button press on the corner of the screen. Currently this is accomplished via
//clearing all pointer events on the first frame after the game is resumed.
config.screenEdgesDeferringSystemGestures = UIRectEdge.All;
if (NSProcessInfo.getSharedProcessInfo().getOperatingSystemVersion().getMajorVersion() >= 11) { if (NSProcessInfo.getSharedProcessInfo().getOperatingSystemVersion().getMajorVersion() >= 11) {
config.preferredFramesPerSecond = (int)(UIScreen.getMainScreen().getMaximumFramesPerSecond()); config.preferredFramesPerSecond = (int)(UIScreen.getMainScreen().getMaximumFramesPerSecond());