mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
(Adventure) Double Tap Avatar to show Menu buttons
- useful for Android devices without navigation buttons (back key to show menu by default) (Gesture detections like Edge detection needs AppCompatActivity which is missing on Forge Android)
This commit is contained in:
@@ -5,6 +5,7 @@ import com.badlogic.gdx.Input;
|
|||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||||
import com.badlogic.gdx.scenes.scene2d.Stage;
|
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||||
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
|
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Image;
|
import com.badlogic.gdx.scenes.scene2d.ui.Image;
|
||||||
@@ -317,7 +318,7 @@ public class GameHUD extends Stage {
|
|||||||
}
|
}
|
||||||
class ConsoleToggleListener extends ActorGestureListener {
|
class ConsoleToggleListener extends ActorGestureListener {
|
||||||
public ConsoleToggleListener() {
|
public ConsoleToggleListener() {
|
||||||
getGestureDetector().setLongPressSeconds(0.5f);
|
getGestureDetector().setLongPressSeconds(0.6f);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean longPress(Actor actor, float x, float y) {
|
public boolean longPress(Actor actor, float x, float y) {
|
||||||
@@ -325,5 +326,12 @@ public class GameHUD extends Stage {
|
|||||||
console.toggle();
|
console.toggle();
|
||||||
return super.longPress(actor, x, y);
|
return super.longPress(actor, x, y);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public void tap(InputEvent event, float x, float y, int count, int button) {
|
||||||
|
super.tap(event, x, y, count, button);
|
||||||
|
//show menu buttons if double tapping the avatar, for android devices without visible navigation buttons
|
||||||
|
if (count > 1)
|
||||||
|
showButtons();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user