mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +00:00
[Mobile] Fix cards hovered on MatchScreen
This commit is contained in:
@@ -83,6 +83,7 @@ public class Forge implements ApplicationListener {
|
|||||||
public static boolean autoCache = false;
|
public static boolean autoCache = false;
|
||||||
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 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) {
|
||||||
@@ -920,11 +921,11 @@ public class Forge implements ApplicationListener {
|
|||||||
|
|
||||||
//mouseMoved and scrolled events for desktop version
|
//mouseMoved and scrolled events for desktop version
|
||||||
private int mouseMovedX, mouseMovedY;
|
private int mouseMovedX, mouseMovedY;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mouseMoved(int screenX, int screenY) {
|
public boolean mouseMoved(int screenX, int screenY) {
|
||||||
mouseMovedX = screenX;
|
mouseMovedX = screenX;
|
||||||
mouseMovedY = screenY;
|
mouseMovedY = screenY;
|
||||||
|
hoveredCount = 0;
|
||||||
//reset
|
//reset
|
||||||
try {
|
try {
|
||||||
for (FDisplayObject listener : potentialListeners) {
|
for (FDisplayObject listener : potentialListeners) {
|
||||||
|
|||||||
@@ -96,7 +96,6 @@ public class FCardPanel extends FDisplayObject {
|
|||||||
public void draw(Graphics g) {
|
public void draw(Graphics g) {
|
||||||
if (card == null) { return; }
|
if (card == null) { return; }
|
||||||
boolean animate = Forge.animatedCardTapUntap;
|
boolean animate = Forge.animatedCardTapUntap;
|
||||||
//TODO: FCardPanel ishovered and CardStackPosition is BehindHorz or BehindVert...
|
|
||||||
float mod = isHighlighted()||isHovered() ? getWidth()/16f : 0f;
|
float mod = isHighlighted()||isHovered() ? getWidth()/16f : 0f;
|
||||||
float padding = getPadding();
|
float padding = getPadding();
|
||||||
float x = padding-mod/2;
|
float x = padding-mod/2;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import com.badlogic.gdx.math.Rectangle;
|
import com.badlogic.gdx.math.Rectangle;
|
||||||
|
|
||||||
|
import forge.Forge;
|
||||||
import forge.Graphics;
|
import forge.Graphics;
|
||||||
|
|
||||||
public abstract class FDisplayObject {
|
public abstract class FDisplayObject {
|
||||||
@@ -130,8 +131,10 @@ public abstract class FDisplayObject {
|
|||||||
if (enabled && visible && screenPos.contains(screenX, screenY)) {
|
if (enabled && visible && screenPos.contains(screenX, screenY)) {
|
||||||
listeners.add(this);
|
listeners.add(this);
|
||||||
}
|
}
|
||||||
//TODO: needs better logic, it must be the only current selectable
|
Forge.hoveredCount = listeners.size();
|
||||||
setHovered(this.enabled && this.visible && this.screenPos.contains(screenX, screenY));
|
if (!Forge.getCurrentScreen().toString().contains("Match"))
|
||||||
|
Forge.hoveredCount = 1;
|
||||||
|
setHovered(this.enabled && this.visible && this.screenPos.contains(screenX, screenY) && Forge.hoveredCount < 2);
|
||||||
scrX = screenX;
|
scrX = screenX;
|
||||||
scrY = screenY;
|
scrY = screenY;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user