mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +00:00
Try to prevent rapid tap on Start Button causing issues on Android
This commit is contained in:
@@ -41,6 +41,9 @@ public abstract class LaunchScreen extends FScreen {
|
||||
|
||||
protected class StartButton extends FDisplayObject {
|
||||
private boolean pressed;
|
||||
private long lastTap;
|
||||
private int tapCount;
|
||||
private float lastX, lastY;
|
||||
|
||||
/**
|
||||
* Instantiates a new FButton.
|
||||
@@ -62,8 +65,13 @@ public abstract class LaunchScreen extends FScreen {
|
||||
|
||||
@Override
|
||||
public final boolean tap(float x, float y, int count) {
|
||||
if (count == 1) {
|
||||
tapCount = count;
|
||||
lastX = x;
|
||||
lastY = y;
|
||||
lastTap = System.currentTimeMillis(); //try prevent rapid tap on start button causing issues
|
||||
if (tapCount == 1 && System.currentTimeMillis() - lastTap < 10 && lastX == x && lastY == y) {
|
||||
startMatch();
|
||||
tapCount++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user