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 {
|
protected class StartButton extends FDisplayObject {
|
||||||
private boolean pressed;
|
private boolean pressed;
|
||||||
|
private long lastTap;
|
||||||
|
private int tapCount;
|
||||||
|
private float lastX, lastY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new FButton.
|
* Instantiates a new FButton.
|
||||||
@@ -62,8 +65,13 @@ public abstract class LaunchScreen extends FScreen {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final boolean tap(float x, float y, int count) {
|
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();
|
startMatch();
|
||||||
|
tapCount++;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user