mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
Add more style to Planar Map screen
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -16863,6 +16863,7 @@ forge-gui/res/skins/dark_ascension/font1.ttf -text
|
||||
forge-gui/res/skins/dark_ascension/sprite_icons.png -text
|
||||
forge-gui/res/skins/default/bg_draft_deck.png -text
|
||||
forge-gui/res/skins/default/bg_match.jpg -text
|
||||
forge-gui/res/skins/default/bg_monitor.png -text
|
||||
forge-gui/res/skins/default/bg_planar_map.png -text
|
||||
forge-gui/res/skins/default/bg_splash.png -text
|
||||
forge-gui/res/skins/default/bg_texture.jpg -text
|
||||
|
||||
@@ -1170,6 +1170,7 @@ public class FSkin {
|
||||
SkinIcon.setIcon(FSkinProp.BG_TEXTURE, preferredDir + ForgeConstants.TEXTURE_BG_FILE);
|
||||
SkinIcon.setIcon(FSkinProp.BG_MATCH, preferredDir + ForgeConstants.MATCH_BG_FILE);
|
||||
SkinIcon.setIcon(FSkinProp.BG_PLANAR_MAP, preferredDir + ForgeConstants.PLANAR_MAP_BG_FILE);
|
||||
SkinIcon.setIcon(FSkinProp.BG_MONITOR, preferredDir + ForgeConstants.MONITOR_BG_FILE);
|
||||
|
||||
// Run through enums and load their coords.
|
||||
Colors.updateAll();
|
||||
|
||||
@@ -10,7 +10,8 @@ import forge.properties.ForgeConstants;
|
||||
public enum FSkinTexture implements FImage {
|
||||
BG_TEXTURE(ForgeConstants.TEXTURE_BG_FILE, true),
|
||||
BG_MATCH(ForgeConstants.MATCH_BG_FILE, false),
|
||||
BG_PLANAR_MAP(ForgeConstants.PLANAR_MAP_BG_FILE, false);
|
||||
BG_PLANAR_MAP(ForgeConstants.PLANAR_MAP_BG_FILE, false),
|
||||
BG_MONITOR(ForgeConstants.MONITOR_BG_FILE, false);
|
||||
|
||||
private final String filename;
|
||||
private final boolean repeat;
|
||||
|
||||
@@ -2,16 +2,15 @@ package forge.screens.planarconquest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
|
||||
import forge.Graphics;
|
||||
import forge.assets.FImage;
|
||||
import forge.assets.FSkinColor;
|
||||
import forge.assets.FSkinFont;
|
||||
import forge.assets.FSkinImage;
|
||||
import forge.assets.FSkinTexture;
|
||||
import forge.assets.TextRenderer;
|
||||
import forge.assets.FSkinColor.Colors;
|
||||
import forge.card.CardRenderer;
|
||||
import forge.card.CardRenderer.CardStackPosition;
|
||||
import forge.game.card.Card;
|
||||
@@ -26,20 +25,11 @@ import forge.screens.FScreen;
|
||||
import forge.toolbox.FCardPanel;
|
||||
import forge.toolbox.FContainer;
|
||||
import forge.toolbox.FDisplayObject;
|
||||
import forge.toolbox.FEvent;
|
||||
import forge.toolbox.FLabel;
|
||||
import forge.toolbox.FEvent.FEventHandler;
|
||||
import forge.util.Utils;
|
||||
|
||||
public class ConquestMapScreen extends FScreen {
|
||||
private static final FSkinColor BTN_PRESSED_COLOR = FSkinColor.get(Colors.CLR_THEME2);
|
||||
private static final FSkinColor LINE_COLOR = BTN_PRESSED_COLOR.stepColor(-40);
|
||||
private static final FSkinColor BACK_COLOR = BTN_PRESSED_COLOR.stepColor(-80);
|
||||
private static final FSkinColor FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT);
|
||||
private static final FSkinColor BORDER_COLOR = FSkinColor.get(Colors.CLR_BORDERS);
|
||||
private static final float LINE_THICKNESS = Utils.scale(1);
|
||||
private static final float ARROW_ICON_THICKNESS = Utils.scale(3);
|
||||
private static final float REGION_SLIDER_HEIGHT = Math.round(Utils.AVG_FINGER_HEIGHT * 0.7f);
|
||||
private static final float BORDER_THICKNESS = Utils.scale(1);
|
||||
private static final FSkinFont REGION_NAME_FONT = FSkinFont.get(15);
|
||||
private static final FSkinFont UNLOCK_WINS_FONT = FSkinFont.get(18);
|
||||
private static final float COMMANDER_ROW_PADDING = Utils.scale(16);
|
||||
@@ -63,7 +53,7 @@ public class ConquestMapScreen extends FScreen {
|
||||
|
||||
public void update() {
|
||||
model = FModel.getConquest().getModel();
|
||||
setHeaderCaption(model.getName() + " - Map");
|
||||
setHeaderCaption(model.getName());
|
||||
lblCurrentPlane.setText("Plane - " + model.getCurrentPlane().getName());
|
||||
btnEndDay.setText("End Day " + model.getDay());
|
||||
}
|
||||
@@ -92,62 +82,10 @@ public class ConquestMapScreen extends FScreen {
|
||||
regionDisplay.setBounds(0, startY, width, commanderRow.getTop() - startY);
|
||||
}
|
||||
|
||||
private class RegionDisplay extends FContainer {
|
||||
private final FLabel btnPrev, btnNext;
|
||||
private class RegionDisplay extends FDisplayObject {
|
||||
private final TextRenderer textRenderer = new TextRenderer();
|
||||
|
||||
public RegionDisplay() {
|
||||
btnPrev = add(new FLabel.Builder().icon(new ArrowIcon(REGION_SLIDER_HEIGHT, REGION_SLIDER_HEIGHT, false)).pressedColor(BTN_PRESSED_COLOR).align(HAlignment.CENTER).command(new FEventHandler() {
|
||||
@Override
|
||||
public void handleEvent(FEvent e) {
|
||||
model.incrementRegion(-1);
|
||||
}
|
||||
}).build());
|
||||
btnNext = add(new FLabel.Builder().icon(new ArrowIcon(REGION_SLIDER_HEIGHT, REGION_SLIDER_HEIGHT, true)).pressedColor(BTN_PRESSED_COLOR).align(HAlignment.CENTER).command(new FEventHandler() {
|
||||
@Override
|
||||
public void handleEvent(FEvent e) {
|
||||
model.incrementRegion(1);
|
||||
}
|
||||
}).build());
|
||||
btnPrev.setSize(REGION_SLIDER_HEIGHT, REGION_SLIDER_HEIGHT);
|
||||
btnNext.setSize(REGION_SLIDER_HEIGHT, REGION_SLIDER_HEIGHT);
|
||||
}
|
||||
|
||||
private class ArrowIcon implements FImage {
|
||||
private final float width, height;
|
||||
private final boolean flip;
|
||||
|
||||
public ArrowIcon(float width0, float height0, boolean flip0) {
|
||||
width = width0;
|
||||
height = height0;
|
||||
flip = flip0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Graphics g, float x, float y, float w, float h) {
|
||||
float xMid = x + w * 0.4f;
|
||||
float yMid = y + h / 2;
|
||||
float offsetX = h / 8;
|
||||
float offsetY = w / 4;
|
||||
|
||||
if (flip) {
|
||||
xMid = x + w * 0.6f;
|
||||
offsetX = -offsetX;
|
||||
}
|
||||
|
||||
g.drawLine(ARROW_ICON_THICKNESS, FORE_COLOR, xMid + offsetX, yMid - offsetY, xMid - offsetX, yMid + 1);
|
||||
g.drawLine(ARROW_ICON_THICKNESS, FORE_COLOR, xMid - offsetX, yMid - 1, xMid + offsetX, yMid + offsetY);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -166,33 +104,26 @@ public class ConquestMapScreen extends FScreen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(Graphics g) {
|
||||
float w = getWidth();
|
||||
float h = getHeight();
|
||||
float y = h - REGION_SLIDER_HEIGHT;
|
||||
g.fillRect(BACK_COLOR, 0, y, w, REGION_SLIDER_HEIGHT);
|
||||
if (model != null) {
|
||||
public void draw(Graphics g) {
|
||||
if (model == null) { return; }
|
||||
Region region = model.getCurrentRegion();
|
||||
g.drawImage((FImage)region.getArt(), 0, 0, w, y);
|
||||
textRenderer.drawText(g, region.getName(), REGION_NAME_FONT, FORE_COLOR, REGION_SLIDER_HEIGHT, y, w - 2 * REGION_SLIDER_HEIGHT, REGION_SLIDER_HEIGHT, y, REGION_SLIDER_HEIGHT, false, HAlignment.CENTER, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawOverlay(Graphics g) {
|
||||
float w = getWidth();
|
||||
float y2 = getHeight();
|
||||
float y1 = y2 - REGION_SLIDER_HEIGHT;
|
||||
g.drawLine(LINE_THICKNESS, LINE_COLOR, 0, y1, w, y1);
|
||||
g.drawLine(LINE_THICKNESS, LINE_COLOR, 0, y2, w, y2);
|
||||
}
|
||||
float x = COMMANDER_GAP / 2;
|
||||
float y = COMMANDER_GAP;
|
||||
float w = getWidth() - 2 * x;
|
||||
float h = getHeight() - y;
|
||||
float regionFrameThickness = 15f / 443f * w;
|
||||
float regionFrameBaseHeight = 25f / 317f * h;
|
||||
|
||||
@Override
|
||||
protected void doLayout(float width, float height) {
|
||||
float y = height - REGION_SLIDER_HEIGHT;
|
||||
float size = REGION_SLIDER_HEIGHT;
|
||||
btnPrev.setBounds(0, y, size, size);
|
||||
btnNext.setBounds(width - REGION_SLIDER_HEIGHT, y, size, size);
|
||||
g.startClip(x + regionFrameThickness, y + regionFrameThickness, w - 2 * regionFrameThickness, h - regionFrameThickness - regionFrameBaseHeight);
|
||||
g.drawImage((FImage)region.getArt(), x, y, w, h);
|
||||
g.endClip();
|
||||
|
||||
g.drawImage(FSkinTexture.BG_MONITOR, x, y, w, h);
|
||||
|
||||
y += h - regionFrameBaseHeight;
|
||||
h = regionFrameBaseHeight * 0.9f;
|
||||
textRenderer.drawText(g, region.getName(), REGION_NAME_FONT, Color.BLACK, x, y, w, h, y, h, false, HAlignment.CENTER, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,7 +162,7 @@ public class ConquestMapScreen extends FScreen {
|
||||
public void draw(Graphics g) {
|
||||
float w = getWidth();
|
||||
float h = getHeight();
|
||||
g.drawRect(LINE_THICKNESS, BORDER_COLOR, -LINE_THICKNESS, -LINE_THICKNESS, w + 2 * LINE_THICKNESS, h + 2 * LINE_THICKNESS);
|
||||
g.drawRect(BORDER_THICKNESS, Color.WHITE, -BORDER_THICKNESS, -BORDER_THICKNESS, w + 2 * BORDER_THICKNESS, h + 2 * BORDER_THICKNESS);
|
||||
|
||||
ConquestPlaneData planeData = model.getCurrentPlaneData();
|
||||
if (card == null) {
|
||||
@@ -263,7 +194,7 @@ public class ConquestMapScreen extends FScreen {
|
||||
g.drawImage(FSkinImage.LOCK, (w - imageSize) / 2, (h - imageSize) / 2, imageSize, imageSize);
|
||||
g.resetAlphaComposite();
|
||||
float y = (h + imageSize) / 2;
|
||||
g.drawText(String.valueOf(winsToUnlock), UNLOCK_WINS_FONT, FORE_COLOR, 0, y, w, h - y, false, HAlignment.CENTER, true);
|
||||
g.drawText(String.valueOf(winsToUnlock), UNLOCK_WINS_FONT, Color.WHITE, 0, y, w, h - y, false, HAlignment.CENTER, true);
|
||||
}
|
||||
else {
|
||||
|
||||
|
||||
BIN
forge-gui/res/skins/default/bg_monitor.png
Normal file
BIN
forge-gui/res/skins/default/bg_monitor.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.6 KiB |
@@ -28,6 +28,7 @@ public enum FSkinProp {
|
||||
BG_TEXTURE (null, PropType.BACKGROUND),
|
||||
BG_MATCH (null, PropType.BACKGROUND),
|
||||
BG_PLANAR_MAP (null, PropType.BACKGROUND),
|
||||
BG_MONITOR (null, PropType.BACKGROUND),
|
||||
|
||||
//colors
|
||||
CLR_THEME (new int[] {70, 10}, PropType.COLOR),
|
||||
|
||||
@@ -80,8 +80,9 @@ public final class ForgeConstants {
|
||||
public static final String FONT_FILE = "font1.ttf";
|
||||
public static final String SPLASH_BG_FILE = "bg_splash.png";
|
||||
public static final String MATCH_BG_FILE = "bg_match.jpg";
|
||||
public static final String PLANAR_MAP_BG_FILE = "bg_planar_map.png";
|
||||
public static final String TEXTURE_BG_FILE = "bg_texture.jpg";
|
||||
public static final String PLANAR_MAP_BG_FILE = "bg_planar_map.png";
|
||||
public static final String MONITOR_BG_FILE = "bg_monitor.png";
|
||||
public static final String DRAFT_DECK_IMG_FILE = "bg_draft_deck.png";
|
||||
|
||||
// data tree roots
|
||||
|
||||
Reference in New Issue
Block a user