mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
[Mobile] enable mouseMoved and update some selectable element
This commit is contained in:
@@ -922,9 +922,10 @@ public class Forge implements ApplicationListener {
|
|||||||
private int mouseMovedX, mouseMovedY;
|
private int mouseMovedX, mouseMovedY;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mouseMoved(int x, int y) {
|
public boolean mouseMoved(int screenX, int screenY) {
|
||||||
mouseMovedX = x;
|
mouseMovedX = screenX;
|
||||||
mouseMovedY = y;
|
mouseMovedY = screenY;
|
||||||
|
updatePotentialListeners(screenX, screenY);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -331,10 +331,18 @@ public class FSkinFont {
|
|||||||
return fontSize > MIN_FONT_SIZE;
|
return fontSize > MIN_FONT_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean canIncrease() {
|
||||||
|
return MAX_FONT_SIZE - fontSize > 2;
|
||||||
|
}
|
||||||
|
|
||||||
public FSkinFont shrink() {
|
public FSkinFont shrink() {
|
||||||
return _get(fontSize - 1);
|
return _get(fontSize - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FSkinFont increase() {
|
||||||
|
return _get(fontSize + 3);
|
||||||
|
}
|
||||||
|
|
||||||
public String getCharacterSet(String langCode) {
|
public String getCharacterSet(String langCode) {
|
||||||
if (langUniqueCharacterSet.containsKey(langCode)) {
|
if (langUniqueCharacterSet.containsKey(langCode)) {
|
||||||
return langUniqueCharacterSet.get(langCode);
|
return langUniqueCharacterSet.get(langCode);
|
||||||
|
|||||||
@@ -87,9 +87,9 @@ public abstract class ItemManager<T extends InventoryItem> extends FContainer im
|
|||||||
private final TextSearchFilter<? extends T> searchFilter;
|
private final TextSearchFilter<? extends T> searchFilter;
|
||||||
|
|
||||||
private final FLabel btnSearch = new FLabel.ButtonBuilder()
|
private final FLabel btnSearch = new FLabel.ButtonBuilder()
|
||||||
.icon(Forge.hdbuttons ? FSkinImage.HDSEARCH : FSkinImage.SEARCH).iconScaleFactor(0.9f).build();
|
.icon(Forge.hdbuttons ? FSkinImage.HDSEARCH : FSkinImage.SEARCH).iconScaleFactor(0.9f).selectable().build();
|
||||||
private final FLabel btnView = new FLabel.ButtonBuilder()
|
private final FLabel btnView = new FLabel.ButtonBuilder()
|
||||||
.iconScaleFactor(0.9f).build(); //icon set later
|
.iconScaleFactor(0.9f).selectable().build(); //icon set later
|
||||||
private final FLabel btnAdvancedSearchOptions = new FLabel.Builder()
|
private final FLabel btnAdvancedSearchOptions = new FLabel.Builder()
|
||||||
.selectable(true).align(Align.center)
|
.selectable(true).align(Align.center)
|
||||||
.icon(Forge.hdbuttons ? FSkinImage.HDPREFERENCE : FSkinImage.SETTINGS).iconScaleFactor(0.9f)
|
.icon(Forge.hdbuttons ? FSkinImage.HDPREFERENCE : FSkinImage.SETTINGS).iconScaleFactor(0.9f)
|
||||||
|
|||||||
@@ -120,6 +120,9 @@ public class FMenuItem extends FDisplayObject implements IButton {
|
|||||||
float w = getWidth();
|
float w = getWidth();
|
||||||
float h = HEIGHT;
|
float h = HEIGHT;
|
||||||
|
|
||||||
|
if (isHovered() && !pressed)
|
||||||
|
g.fillRect(PRESSED_COLOR.brighter().alphaColor(0.4f), 0, 0, w, h);
|
||||||
|
|
||||||
if (showPressedColor()) {
|
if (showPressedColor()) {
|
||||||
g.fillRect(PRESSED_COLOR, 0, 0, w, h);
|
g.fillRect(PRESSED_COLOR, 0, 0, w, h);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,6 +99,8 @@ public class FMenuTab extends FDisplayObject {
|
|||||||
y = PADDING;
|
y = PADDING;
|
||||||
w = getWidth() - 2 * PADDING;
|
w = getWidth() - 2 * PADDING;
|
||||||
h = getHeight() - 2 * PADDING;
|
h = getHeight() - 2 * PADDING;
|
||||||
|
if (isHovered())
|
||||||
|
g.fillRect(SEL_BACK_COLOR.brighter(), x, y, w, h);
|
||||||
g.drawText(text, FONT, foreColor, x, y, w, h, false, Align.center, true);
|
g.drawText(text, FONT, foreColor, x, y, w, h, false, Align.center, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,11 +78,12 @@ public abstract class LaunchScreen extends FScreen {
|
|||||||
@Override
|
@Override
|
||||||
public void draw(Graphics g) {
|
public void draw(Graphics g) {
|
||||||
if (Forge.hdstart)
|
if (Forge.hdstart)
|
||||||
g.drawImage(pressed ? FSkinImage.HDBTN_START_DOWN : FSkinImage.HDBTN_START_UP,
|
g.drawImage(pressed ? FSkinImage.HDBTN_START_DOWN :
|
||||||
0, 0, getWidth(), getHeight());
|
isHovered() ? FSkinImage.HDBTN_START_OVER : FSkinImage.HDBTN_START_UP,
|
||||||
|
isHovered() ? -2 : 0, 0, getWidth(), getHeight());
|
||||||
else
|
else
|
||||||
g.drawImage(pressed ? FSkinImage.BTN_START_DOWN : FSkinImage.BTN_START_UP,
|
g.drawImage(pressed ? FSkinImage.BTN_START_DOWN :
|
||||||
0, 0, getWidth(), getHeight());
|
isHovered() ? FSkinImage.BTN_START_OVER : FSkinImage.BTN_START_UP, 0, 0, getWidth(), getHeight());
|
||||||
//its must be enabled or you can't start any game modes
|
//its must be enabled or you can't start any game modes
|
||||||
if (!Forge.isLoadingaMatch()) {
|
if (!Forge.isLoadingaMatch()) {
|
||||||
if(!btnStart.isEnabled())
|
if(!btnStart.isEnabled())
|
||||||
|
|||||||
@@ -396,8 +396,7 @@ public class TabPageScreen<T extends TabPageScreen<T>> extends FScreen {
|
|||||||
g.drawText(caption, font, TAB_FORE_COLOR, x, y, w, h, false, Align.left, true);
|
g.drawText(caption, font, TAB_FORE_COLOR, x, y, w, h, false, Align.left, true);
|
||||||
g.endClip();
|
g.endClip();
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
float y = h - padding - TAB_FONT.getCapHeight();
|
float y = h - padding - TAB_FONT.getCapHeight();
|
||||||
g.drawText(caption, TAB_FONT, TAB_FORE_COLOR, padding, y - padding, w, h - y + padding, false, Align.center, true);
|
g.drawText(caption, TAB_FONT, TAB_FORE_COLOR, padding, y - padding, w, h - y + padding, false, Align.center, true);
|
||||||
|
|
||||||
@@ -408,7 +407,8 @@ public class TabPageScreen<T extends TabPageScreen<T>> extends FScreen {
|
|||||||
iconHeight *= w / iconWidth;
|
iconHeight *= w / iconWidth;
|
||||||
iconWidth = w;
|
iconWidth = w;
|
||||||
}
|
}
|
||||||
g.drawImage(icon, padding + (w - iconWidth) / 2, (y - iconHeight) / 2, iconWidth, iconHeight);
|
float mod = isHovered() ? iconWidth/8f : 0;
|
||||||
|
g.drawImage(icon, (padding + (w - iconWidth) / 2)-mod/2, ((y - iconHeight) / 2)-mod/2, iconWidth+mod, iconHeight+mod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,8 +60,8 @@ public class PlayerPanel extends FContainer {
|
|||||||
private LobbySlotType type = LobbySlotType.LOCAL;
|
private LobbySlotType type = LobbySlotType.LOCAL;
|
||||||
|
|
||||||
private final FLabel nameRandomiser;
|
private final FLabel nameRandomiser;
|
||||||
private final FLabel avatarLabel = new FLabel.Builder().opaque(true).iconScaleFactor(0.99f).alphaComposite(1).iconInBackground(true).build();
|
private final FLabel avatarLabel = new FLabel.Builder().opaque(true).iconScaleFactor(0.99f).selectable().alphaComposite(1).iconInBackground(true).build();
|
||||||
private final FLabel sleeveLabel = new FLabel.Builder().opaque(true).iconScaleFactor(0.99f).alphaComposite(1).iconInBackground(true).build();
|
private final FLabel sleeveLabel = new FLabel.Builder().opaque(true).iconScaleFactor(0.99f).selectable().alphaComposite(1).iconInBackground(true).build();
|
||||||
private int avatarIndex, sleeveIndex;
|
private int avatarIndex, sleeveIndex;
|
||||||
|
|
||||||
final Localizer localizer = Localizer.getInstance();
|
final Localizer localizer = Localizer.getInstance();
|
||||||
|
|||||||
@@ -314,7 +314,7 @@ public class HomeScreen extends FScreen {
|
|||||||
public void draw(Graphics g) {
|
public void draw(Graphics g) {
|
||||||
if (Forge.isLandscapeMode()) {
|
if (Forge.isLandscapeMode()) {
|
||||||
//draw text only for Landscape mode
|
//draw text only for Landscape mode
|
||||||
g.drawText(getText(), getFont(), getForeColor(), 0, 0, getWidth(), getHeight(), false, Align.left, true);
|
g.drawText(getText(), isHovered() && getFont().canIncrease() ? getFont().increase() : getFont(), getForeColor(), 0, 0, getWidth(), getHeight(), false, Align.left, true);
|
||||||
}
|
}
|
||||||
else { //draw buttons normally for portrait mode
|
else { //draw buttons normally for portrait mode
|
||||||
super.draw(g);
|
super.draw(g);
|
||||||
|
|||||||
@@ -126,8 +126,8 @@ public class VAvatar extends FDisplayObject {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Graphics g) {
|
public void draw(Graphics g) {
|
||||||
float w = getWidth();
|
float w = isHovered() ? getWidth()/16f+getWidth() : getWidth();
|
||||||
float h = getHeight();
|
float h = isHovered() ? getWidth()/16f+getHeight() : getHeight();
|
||||||
|
|
||||||
if (avatarAnimation != null && !MatchController.instance.getGameView().isMatchOver()) {
|
if (avatarAnimation != null && !MatchController.instance.getGameView().isMatchOver()) {
|
||||||
if (player.wasAvatarLifeChanged()) {
|
if (player.wasAvatarLifeChanged()) {
|
||||||
|
|||||||
@@ -159,8 +159,8 @@ public class VPhaseIndicator extends FContainer {
|
|||||||
else {
|
else {
|
||||||
backColor = FSkinColor.get(Colors.CLR_PHASE_INACTIVE_DISABLED);
|
backColor = FSkinColor.get(Colors.CLR_PHASE_INACTIVE_DISABLED);
|
||||||
}
|
}
|
||||||
g.fillRect(backColor, x, 0, w, h);
|
g.fillRect(isHovered() ? backColor.brighter() : backColor, x, 0, w, h);
|
||||||
g.drawText(caption, font, Color.BLACK, x, 0, w, h, false, Align.center, true);
|
g.drawText(caption, isHovered() && font.canIncrease() ? font.increase() : font, Color.BLACK, x, 0, w, h, false, Align.center, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -610,7 +610,8 @@ public class VPlayerPanel extends FContainer {
|
|||||||
if (lblLife.getRotate180()) {
|
if (lblLife.getRotate180()) {
|
||||||
g.startRotateTransform(x + w / 2, y + h / 2, 180);
|
g.startRotateTransform(x + w / 2, y + h / 2, 180);
|
||||||
}
|
}
|
||||||
g.drawImage(icon, x, y, w, h);
|
float mod = isHovered() ? w/8f:0;
|
||||||
|
g.drawImage(icon, x-mod/2, y-mod/2, w+mod, h+mod);
|
||||||
if (lblLife.getRotate180()) {
|
if (lblLife.getRotate180()) {
|
||||||
g.endTransform();
|
g.endTransform();
|
||||||
}
|
}
|
||||||
@@ -637,7 +638,8 @@ public class VPlayerPanel extends FContainer {
|
|||||||
h = icon.getHeight() * w / icon.getWidth();
|
h = icon.getHeight() * w / icon.getWidth();
|
||||||
x = (getWidth() - w) / 2;
|
x = (getWidth() - w) / 2;
|
||||||
y = INFO_TAB_PADDING_Y;
|
y = INFO_TAB_PADDING_Y;
|
||||||
g.drawImage(icon, x, y, w, h);
|
float mod = isHovered() ? w/8f:0;
|
||||||
|
g.drawImage(icon, x-mod/2, y-mod/2, w+mod, h+mod);
|
||||||
|
|
||||||
y += h + INFO_TAB_PADDING_Y;
|
y += h + INFO_TAB_PADDING_Y;
|
||||||
g.drawText(value, INFO_FONT, INFO_FORE_COLOR, 0, y, getWidth(), getHeight() - y + 1, false, Align.center, false);
|
g.drawText(value, INFO_FONT, INFO_FORE_COLOR, 0, y, getWidth(), getHeight() - y + 1, false, Align.center, false);
|
||||||
|
|||||||
@@ -373,7 +373,7 @@ public class VStack extends FDropDown {
|
|||||||
|
|
||||||
g.startClip(0, 0, w, getHeight()); //clip based on actual height
|
g.startClip(0, 0, w, getHeight()); //clip based on actual height
|
||||||
|
|
||||||
g.fillRect(Color.BLACK, x, y, w, h); //draw rectangle for border
|
g.fillRect(isHovered() ? Color.GRAY : Color.BLACK, x, y, w, h); //draw rectangle for border
|
||||||
|
|
||||||
x += BORDER_THICKNESS;
|
x += BORDER_THICKNESS;
|
||||||
y += BORDER_THICKNESS;
|
y += BORDER_THICKNESS;
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class ViewWinLose extends FOverlay implements IWinLoseView<FButton> {
|
|||||||
private static final float GAP_Y_FACTOR = 0.02f;
|
private static final float GAP_Y_FACTOR = 0.02f;
|
||||||
|
|
||||||
private final FButton btnContinue, btnRestart, btnQuit;
|
private final FButton btnContinue, btnRestart, btnQuit;
|
||||||
private final FLabel lblTitle, lblLog, lblStats, btnCopyLog, btnMinimize;
|
private final FLabel lblTitle, lblLog, lblStats, btnCopyLog, btnShowBattlefield;
|
||||||
private final FTextArea txtLog;
|
private final FTextArea txtLog;
|
||||||
private final OutcomesPanel pnlOutcomes;
|
private final OutcomesPanel pnlOutcomes;
|
||||||
private final GameView game;
|
private final GameView game;
|
||||||
@@ -109,14 +109,14 @@ public class ViewWinLose extends FOverlay implements IWinLoseView<FButton> {
|
|||||||
});
|
});
|
||||||
txtLog.setFont(FSkinFont.get(12));
|
txtLog.setFont(FSkinFont.get(12));
|
||||||
|
|
||||||
btnCopyLog = add(new FLabel.ButtonBuilder().text(localizer.getMessage("btnCopyToClipboard")).command(new FEventHandler() {
|
btnCopyLog = add(new FLabel.ButtonBuilder().text(localizer.getMessage("btnCopyToClipboard")).selectable().command(new FEventHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(FEvent e) {
|
public void handleEvent(FEvent e) {
|
||||||
Forge.getClipboard().setContents(txtLog.getText());
|
Forge.getClipboard().setContents(txtLog.getText());
|
||||||
}
|
}
|
||||||
}).build());
|
}).build());
|
||||||
|
|
||||||
btnMinimize = add(new FLabel.ButtonBuilder().text(localizer.getMessage("lblMinimize")).font(FSkinFont.get(12)).command(new FEventHandler() {
|
btnShowBattlefield = add(new FLabel.ButtonBuilder().text(localizer.getMessage("lblShowBattlefield")).font(FSkinFont.get(12)).selectable().command(new FEventHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(FEvent e) {
|
public void handleEvent(FEvent e) {
|
||||||
hide();
|
hide();
|
||||||
@@ -208,7 +208,7 @@ public class ViewWinLose extends FOverlay implements IWinLoseView<FButton> {
|
|||||||
float y2 = height - dy - h;
|
float y2 = height - dy - h;
|
||||||
btnCopyLog.setBounds(width / 4, y2, width / 2, h);
|
btnCopyLog.setBounds(width / 4, y2, width / 2, h);
|
||||||
txtLog.setBounds(x, y, w, y2 - y - dy);
|
txtLog.setBounds(x, y, w, y2 - y - dy);
|
||||||
btnMinimize.setBounds(width / 4,0,width / 2, h);
|
btnShowBattlefield.setBounds(width / 4,0,width / 2, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class OutcomesPanel extends FContainer {
|
private static class OutcomesPanel extends FContainer {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ public class FButton extends FDisplayObject implements IButton {
|
|||||||
private FSkinFont font;
|
private FSkinFont font;
|
||||||
private FSkinColor foreColor = DEFAULT_FORE_COLOR;
|
private FSkinColor foreColor = DEFAULT_FORE_COLOR;
|
||||||
private boolean toggled = false;
|
private boolean toggled = false;
|
||||||
|
private boolean pressed = false;
|
||||||
private FEventHandler command;
|
private FEventHandler command;
|
||||||
|
|
||||||
public enum Corner {
|
public enum Corner {
|
||||||
@@ -182,6 +183,7 @@ public class FButton extends FDisplayObject implements IButton {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final boolean press(float x, float y) {
|
public final boolean press(float x, float y) {
|
||||||
|
pressed = true;
|
||||||
if (isToggled()) { return true; }
|
if (isToggled()) { return true; }
|
||||||
imgL = FSkinImage.BTN_DOWN_LEFT;
|
imgL = FSkinImage.BTN_DOWN_LEFT;
|
||||||
imgM = FSkinImage.BTN_DOWN_CENTER;
|
imgM = FSkinImage.BTN_DOWN_CENTER;
|
||||||
@@ -203,6 +205,7 @@ public class FButton extends FDisplayObject implements IButton {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final boolean release(float x, float y) {
|
public final boolean release(float x, float y) {
|
||||||
|
pressed = false;
|
||||||
if (isToggled()) { return true; }
|
if (isToggled()) { return true; }
|
||||||
resetImg();
|
resetImg();
|
||||||
return true;
|
return true;
|
||||||
@@ -245,21 +248,21 @@ public class FButton extends FDisplayObject implements IButton {
|
|||||||
switch (corner) {
|
switch (corner) {
|
||||||
case None:
|
case None:
|
||||||
if (w > 2 * h) {
|
if (w > 2 * h) {
|
||||||
g.drawImage(imgL, 0, 0, h, h);
|
g.drawImage(isHovered() && !pressed ? hdbuttonskin() ? FSkinImage.HDBTN_OVER_LEFT : FSkinImage.BTN_OVER_LEFT : imgL, 0, 0, h, h);
|
||||||
g.drawImage(imgM, h, 0, w - (2 * h), h);
|
g.drawImage(isHovered() && !pressed ? hdbuttonskin() ? FSkinImage.HDBTN_OVER_CENTER : FSkinImage.BTN_OVER_CENTER : imgM, h, 0, w - (2 * h), h);
|
||||||
g.drawImage(imgR, w - h, 0, h, h);
|
g.drawImage(isHovered() && !pressed ? hdbuttonskin() ? FSkinImage.HDBTN_OVER_RIGHT : FSkinImage.BTN_OVER_RIGHT : imgR, w - h, 0, h, h);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
g.drawImage(imgL, 0, 0, cornerButtonWidth, h);
|
g.drawImage(isHovered() && !pressed ? hdbuttonskin() ? FSkinImage.HDBTN_OVER_LEFT : FSkinImage.BTN_OVER_LEFT : imgL, 0, 0, cornerButtonWidth, h);
|
||||||
g.drawImage(imgR, cornerButtonWidth, 0, w - cornerButtonWidth, h);
|
g.drawImage(isHovered() && !pressed ? hdbuttonskin() ? FSkinImage.HDBTN_OVER_RIGHT : FSkinImage.BTN_OVER_RIGHT : imgR, cornerButtonWidth, 0, w - cornerButtonWidth, h);
|
||||||
}
|
}
|
||||||
x += PADDING;
|
x += PADDING;
|
||||||
w -= 2 * PADDING;
|
w -= 2 * PADDING;
|
||||||
break;
|
break;
|
||||||
case BottomLeft:
|
case BottomLeft:
|
||||||
g.startClip(x, y, w, h);
|
g.startClip(x, y, w, h);
|
||||||
g.drawImage(imgM, 0, 0, cornerButtonWidth, cornerButtonHeight);
|
g.drawImage(isHovered() && !pressed ? hdbuttonskin() ? FSkinImage.HDBTN_OVER_CENTER : FSkinImage.BTN_OVER_CENTER : imgM, 0, 0, cornerButtonWidth, cornerButtonHeight);
|
||||||
g.drawImage(imgR, cornerButtonWidth, 0, cornerButtonWidth, cornerButtonHeight);
|
g.drawImage(isHovered() && !pressed ? hdbuttonskin() ? FSkinImage.HDBTN_OVER_RIGHT : FSkinImage.BTN_OVER_RIGHT : imgR, cornerButtonWidth, 0, cornerButtonWidth, cornerButtonHeight);
|
||||||
g.endClip();
|
g.endClip();
|
||||||
w -= cornerTextOffsetX;
|
w -= cornerTextOffsetX;
|
||||||
y += cornerTextOffsetY;
|
y += cornerTextOffsetY;
|
||||||
@@ -267,8 +270,8 @@ public class FButton extends FDisplayObject implements IButton {
|
|||||||
break;
|
break;
|
||||||
case BottomRight:
|
case BottomRight:
|
||||||
g.startClip(x, y, w, h);
|
g.startClip(x, y, w, h);
|
||||||
g.drawImage(imgL, 0, 0, cornerButtonWidth, cornerButtonHeight);
|
g.drawImage(isHovered() && !pressed ? hdbuttonskin() ? FSkinImage.HDBTN_OVER_LEFT : FSkinImage.BTN_OVER_LEFT : imgL, 0, 0, cornerButtonWidth, cornerButtonHeight);
|
||||||
g.drawImage(imgM, cornerButtonWidth, 0, cornerButtonWidth, cornerButtonHeight);
|
g.drawImage(isHovered() && !pressed ? hdbuttonskin() ? FSkinImage.HDBTN_OVER_CENTER : FSkinImage.BTN_OVER_CENTER : imgM, cornerButtonWidth, 0, cornerButtonWidth, cornerButtonHeight);
|
||||||
g.endClip();
|
g.endClip();
|
||||||
x += cornerTextOffsetX;
|
x += cornerTextOffsetX;
|
||||||
w -= cornerTextOffsetX;
|
w -= cornerTextOffsetX;
|
||||||
@@ -279,9 +282,9 @@ public class FButton extends FDisplayObject implements IButton {
|
|||||||
g.startClip(x, y, w, h);
|
g.startClip(x, y, w, h);
|
||||||
cornerButtonWidth = w / 3;
|
cornerButtonWidth = w / 3;
|
||||||
cornerTextOffsetX = cornerButtonWidth / 2;
|
cornerTextOffsetX = cornerButtonWidth / 2;
|
||||||
g.drawImage(imgL, 0, 0, cornerButtonWidth, cornerButtonHeight);
|
g.drawImage(isHovered() && !pressed ? hdbuttonskin() ? FSkinImage.HDBTN_OVER_LEFT : FSkinImage.BTN_OVER_LEFT : imgL, 0, 0, cornerButtonWidth, cornerButtonHeight);
|
||||||
g.drawImage(imgM, cornerButtonWidth, 0, w - 2 * cornerButtonWidth, cornerButtonHeight);
|
g.drawImage(isHovered() && !pressed ? hdbuttonskin() ? FSkinImage.HDBTN_OVER_CENTER : FSkinImage.BTN_OVER_CENTER : imgM, cornerButtonWidth, 0, w - 2 * cornerButtonWidth, cornerButtonHeight);
|
||||||
g.drawImage(imgR, w - cornerButtonWidth, 0, cornerButtonWidth, cornerButtonHeight);
|
g.drawImage(isHovered() && !pressed ? hdbuttonskin() ? FSkinImage.HDBTN_OVER_RIGHT : FSkinImage.BTN_OVER_RIGHT : imgR, w - cornerButtonWidth, 0, cornerButtonWidth, cornerButtonHeight);
|
||||||
g.endClip();
|
g.endClip();
|
||||||
x += cornerTextOffsetX / 2;
|
x += cornerTextOffsetX / 2;
|
||||||
w -= cornerTextOffsetX;
|
w -= cornerTextOffsetX;
|
||||||
|
|||||||
@@ -96,11 +96,13 @@ 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 padding = getPadding();
|
float padding = getPadding();
|
||||||
float x = padding;
|
float x = padding-mod/2;
|
||||||
float y = padding;
|
float y = padding-mod/2;
|
||||||
float w = getWidth() - 2 * padding;
|
float w = (getWidth() - 2 * padding)+mod;
|
||||||
float h = getHeight() - 2 * padding;
|
float h = (getHeight() - 2 * padding)+mod;
|
||||||
if (w == h) { //adjust width if needed to make room for tapping
|
if (w == h) { //adjust width if needed to make room for tapping
|
||||||
w = h / ASPECT_RATIO;
|
w = h / ASPECT_RATIO;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ public abstract class FDisplayObject {
|
|||||||
private boolean enabled = true;
|
private boolean enabled = true;
|
||||||
private boolean rotate90 = false;
|
private boolean rotate90 = false;
|
||||||
private boolean rotate180 = false;
|
private boolean rotate180 = false;
|
||||||
|
private boolean hovered = false;
|
||||||
private final Rectangle bounds = new Rectangle();
|
private final Rectangle bounds = new Rectangle();
|
||||||
public final Rectangle screenPos = new Rectangle();
|
public final Rectangle screenPos = new Rectangle();
|
||||||
|
|
||||||
@@ -86,6 +87,13 @@ public abstract class FDisplayObject {
|
|||||||
visible = b0;
|
visible = b0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isHovered() {
|
||||||
|
return hovered;
|
||||||
|
}
|
||||||
|
public void setHovered(boolean b0) {
|
||||||
|
hovered = b0;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean getRotate90() {
|
public boolean getRotate90() {
|
||||||
return rotate90;
|
return rotate90;
|
||||||
}
|
}
|
||||||
@@ -117,10 +125,15 @@ 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: needs better logic, it must be the only current selectable
|
||||||
|
setHovered(this.enabled && this.visible && this.screenPos.contains(screenX, screenY));
|
||||||
|
scrX = screenX;
|
||||||
|
scrY = screenY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean press(float x, float y) {
|
public boolean press(float x, float y) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package forge.toolbox;
|
package forge.toolbox;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
import com.badlogic.gdx.utils.Align;
|
import com.badlogic.gdx.utils.Align;
|
||||||
|
|
||||||
@@ -378,8 +379,8 @@ public class FLabel extends FDisplayObject implements IButton {
|
|||||||
}
|
}
|
||||||
y += (h - iconHeight) / 2;
|
y += (h - iconHeight) / 2;
|
||||||
}
|
}
|
||||||
|
float mod = isHovered() && selectable ? iconWidth < iconHeight ? iconWidth/8f : iconHeight/8f : 0;
|
||||||
g.drawImage(icon, x, y, iconWidth, iconHeight);
|
g.drawImage(icon, x-mod/2, y-mod/2, iconWidth+mod, iconHeight+mod);
|
||||||
|
|
||||||
if (!text.isEmpty()) {
|
if (!text.isEmpty()) {
|
||||||
x += iconOffset;
|
x += iconOffset;
|
||||||
@@ -388,6 +389,12 @@ public class FLabel extends FDisplayObject implements IButton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!text.isEmpty()) {
|
else if (!text.isEmpty()) {
|
||||||
|
float oldAlpha = g.getfloatAlphaComposite();
|
||||||
|
if (isHovered() && selectable) {
|
||||||
|
g.setAlphaComposite(0.4f);
|
||||||
|
g.fillRect(Color.GRAY, x, y, w, h);
|
||||||
|
g.setAlphaComposite(oldAlpha);
|
||||||
|
}
|
||||||
drawText(g, x, y, w, h, alignment);
|
drawText(g, x, y, w, h, alignment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2591,6 +2591,7 @@ lblUnlockTitleBar=Entriegle Titelzeile
|
|||||||
lblRestoreDown=Unten wiederherstellen
|
lblRestoreDown=Unten wiederherstellen
|
||||||
lblMaximize=Mximieren
|
lblMaximize=Mximieren
|
||||||
lblMinimize=Minimieren
|
lblMinimize=Minimieren
|
||||||
|
lblShowBattlefield=Show Battlefield
|
||||||
#QuestFileLister.java
|
#QuestFileLister.java
|
||||||
lblNameAndRank=Name | Rang
|
lblNameAndRank=Name | Rang
|
||||||
lblModeAndDifficulty=Modus | Schwierigkeit
|
lblModeAndDifficulty=Modus | Schwierigkeit
|
||||||
|
|||||||
@@ -2589,6 +2589,7 @@ lblUnlockTitleBar=Unlock Title Bar
|
|||||||
lblRestoreDown=Restore Down
|
lblRestoreDown=Restore Down
|
||||||
lblMaximize=Maximize
|
lblMaximize=Maximize
|
||||||
lblMinimize=Minimize
|
lblMinimize=Minimize
|
||||||
|
lblShowBattlefield=Show Battlefield
|
||||||
#QuestFileLister.java
|
#QuestFileLister.java
|
||||||
lblNameAndRank=Name | Rank
|
lblNameAndRank=Name | Rank
|
||||||
lblModeAndDifficulty=Mode | Difficulty
|
lblModeAndDifficulty=Mode | Difficulty
|
||||||
|
|||||||
@@ -2589,6 +2589,7 @@ lblUnlockTitleBar=desbloquear la barra de título
|
|||||||
lblRestoreDown=Restaurar abajo
|
lblRestoreDown=Restaurar abajo
|
||||||
lblMaximize=Maximizar
|
lblMaximize=Maximizar
|
||||||
lblMinimize=Minimizar
|
lblMinimize=Minimizar
|
||||||
|
lblShowBattlefield=Show Battlefield
|
||||||
#QuestFileLister.java
|
#QuestFileLister.java
|
||||||
lblNameAndRank=Nombre | Rango
|
lblNameAndRank=Nombre | Rango
|
||||||
lblModeAndDifficulty=Modo | Dificultad
|
lblModeAndDifficulty=Modo | Dificultad
|
||||||
|
|||||||
@@ -2588,6 +2588,7 @@ lblUnlockTitleBar=Sblocca barra del titolo
|
|||||||
lblRestoreDown=Ripristina
|
lblRestoreDown=Ripristina
|
||||||
lblMaximize=Massimizza
|
lblMaximize=Massimizza
|
||||||
lblMinimize=Minimizza
|
lblMinimize=Minimizza
|
||||||
|
lblShowBattlefield=Show Battlefield
|
||||||
#QuestFileLister.java
|
#QuestFileLister.java
|
||||||
lblNameAndRank=Nome | Rango
|
lblNameAndRank=Nome | Rango
|
||||||
lblModeAndDifficulty=Modo | Difficoltà
|
lblModeAndDifficulty=Modo | Difficoltà
|
||||||
|
|||||||
@@ -2588,6 +2588,7 @@ lblUnlockTitleBar=タイトルバーをアンロック
|
|||||||
lblRestoreDown=元に戻す
|
lblRestoreDown=元に戻す
|
||||||
lblMaximize=最大化
|
lblMaximize=最大化
|
||||||
lblMinimize=最小化
|
lblMinimize=最小化
|
||||||
|
lblShowBattlefield=Show Battlefield
|
||||||
#QuestFileLister.java
|
#QuestFileLister.java
|
||||||
lblNameAndRank=名前 | ランク
|
lblNameAndRank=名前 | ランク
|
||||||
lblModeAndDifficulty=モード | 難易度
|
lblModeAndDifficulty=モード | 難易度
|
||||||
|
|||||||
@@ -2590,6 +2590,7 @@ lblUnlockTitleBar=解锁标题栏
|
|||||||
lblRestoreDown=还原
|
lblRestoreDown=还原
|
||||||
lblMaximize=最大化
|
lblMaximize=最大化
|
||||||
lblMinimize=最小化
|
lblMinimize=最小化
|
||||||
|
lblShowBattlefield=Show Battlefield
|
||||||
#QuestFileLister.java
|
#QuestFileLister.java
|
||||||
lblNameAndRank=名称 | 等级
|
lblNameAndRank=名称 | 等级
|
||||||
lblModeAndDifficulty=模式 | 难度
|
lblModeAndDifficulty=模式 | 难度
|
||||||
|
|||||||
Reference in New Issue
Block a user