mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
[Mobile] Disable mouse events for Android
- should have a mouse hotplug detection
This commit is contained in:
@@ -84,6 +84,7 @@ public class Forge implements ApplicationListener {
|
|||||||
public static int lastButtonIndex = 0;
|
public static int lastButtonIndex = 0;
|
||||||
public static String CJK_Font = "";
|
public static String CJK_Font = "";
|
||||||
public static int hoveredCount = 0;
|
public static int hoveredCount = 0;
|
||||||
|
public static boolean afterDBloaded = false;
|
||||||
|
|
||||||
public static ApplicationListener getApp(Clipboard clipboard0, IDeviceAdapter deviceAdapter0, String assetDir0, boolean value, boolean androidOrientation, int totalRAM, boolean isTablet, int AndroidAPI, String AndroidRelease, String deviceName) {
|
public static ApplicationListener getApp(Clipboard clipboard0, IDeviceAdapter deviceAdapter0, String assetDir0, boolean value, boolean androidOrientation, int totalRAM, boolean isTablet, int AndroidAPI, String AndroidRelease, String deviceName) {
|
||||||
if (GuiBase.getInterface() == null) {
|
if (GuiBase.getInterface() == null) {
|
||||||
@@ -251,6 +252,7 @@ public class Forge implements ApplicationListener {
|
|||||||
Gdx.input.setCatchKey(Keys.MENU, true);
|
Gdx.input.setCatchKey(Keys.MENU, true);
|
||||||
openHomeScreen(-1, null); //default for startup
|
openHomeScreen(-1, null); //default for startup
|
||||||
splashScreen = null;
|
splashScreen = null;
|
||||||
|
afterDBloaded = true;
|
||||||
|
|
||||||
boolean isLandscapeMode = isLandscapeMode();
|
boolean isLandscapeMode = isLandscapeMode();
|
||||||
if (isLandscapeMode) { //open preferred new game screen by default if landscape mode
|
if (isLandscapeMode) { //open preferred new game screen by default if landscape mode
|
||||||
@@ -925,6 +927,9 @@ public class Forge implements ApplicationListener {
|
|||||||
public boolean mouseMoved(int screenX, int screenY) {
|
public boolean mouseMoved(int screenX, int screenY) {
|
||||||
mouseMovedX = screenX;
|
mouseMovedX = screenX;
|
||||||
mouseMovedY = screenY;
|
mouseMovedY = screenY;
|
||||||
|
//todo: mouse listener for android?
|
||||||
|
if (GuiBase.isAndroid())
|
||||||
|
return true;
|
||||||
hoveredCount = 0;
|
hoveredCount = 0;
|
||||||
//reset
|
//reset
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.badlogic.gdx.math.Rectangle;
|
|||||||
|
|
||||||
import forge.Forge;
|
import forge.Forge;
|
||||||
import forge.Graphics;
|
import forge.Graphics;
|
||||||
|
import forge.gui.GuiBase;
|
||||||
|
|
||||||
public abstract class FDisplayObject {
|
public abstract class FDisplayObject {
|
||||||
protected static final float DISABLED_COMPOSITE = 0.25f;
|
protected static final float DISABLED_COMPOSITE = 0.25f;
|
||||||
@@ -126,17 +127,17 @@ public abstract class FDisplayObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public abstract void draw(Graphics g);
|
public abstract void draw(Graphics g);
|
||||||
public float scrX, scrY;
|
|
||||||
public void buildTouchListeners(float screenX, float screenY, List<FDisplayObject> listeners) {
|
public void buildTouchListeners(float screenX, float screenY, List<FDisplayObject> listeners) {
|
||||||
if (enabled && visible && screenPos.contains(screenX, screenY)) {
|
if (enabled && visible && screenPos.contains(screenX, screenY)) {
|
||||||
listeners.add(this);
|
listeners.add(this);
|
||||||
}
|
}
|
||||||
|
//TODO: mouse detection on android?
|
||||||
|
if (Forge.afterDBloaded && !GuiBase.isAndroid()) {
|
||||||
Forge.hoveredCount = listeners.size();
|
Forge.hoveredCount = listeners.size();
|
||||||
if (!Forge.getCurrentScreen().toString().contains("Match"))
|
if (!Forge.getCurrentScreen().toString().contains("Match"))
|
||||||
Forge.hoveredCount = 1;
|
Forge.hoveredCount = 1;
|
||||||
setHovered(this.enabled && this.visible && this.screenPos.contains(screenX, screenY) && Forge.hoveredCount < 2);
|
setHovered(this.enabled && this.visible && this.screenPos.contains(screenX, screenY) && Forge.hoveredCount < 2);
|
||||||
scrX = screenX;
|
}
|
||||||
scrY = screenY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean press(float x, float y) {
|
public boolean press(float x, float y) {
|
||||||
|
|||||||
Reference in New Issue
Block a user