mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
Update Start Button
This commit is contained in:
@@ -67,6 +67,7 @@ public class Forge implements ApplicationListener {
|
||||
public static boolean enablePreloadExtendedArt = false;
|
||||
public static String locale = "en-US";
|
||||
public static boolean hdbuttons = false;
|
||||
public static boolean hdstart = false;
|
||||
|
||||
public static ApplicationListener getApp(Clipboard clipboard0, IDeviceAdapter deviceAdapter0, String assetDir0, boolean value) {
|
||||
if (GuiBase.getInterface() == null) {
|
||||
|
||||
@@ -191,6 +191,7 @@ public class FSkin {
|
||||
final FileHandle f9 = getDefaultSkinFile(ForgeConstants.SPRITE_SLEEVES2_FILE);
|
||||
final FileHandle f10 = getDefaultSkinFile(ForgeConstants.SPRITE_BORDER_FILE);
|
||||
final FileHandle f11 = getSkinFile(ForgeConstants.SPRITE_BUTTONS_FILE);
|
||||
final FileHandle f12 = getSkinFile(ForgeConstants.SPRITE_START_FILE);
|
||||
|
||||
try {
|
||||
textures.put(f1.path(), new Texture(f1));
|
||||
@@ -215,6 +216,12 @@ public class FSkin {
|
||||
textures.put(f11.path(), tf11);
|
||||
Forge.hdbuttons = true;
|
||||
} else { Forge.hdbuttons = false; } //how to refresh buttons when a theme don't have hd buttons?
|
||||
if (f12.exists()) {
|
||||
Texture tf12 = new Texture(f12, true);
|
||||
tf12.setFilter(Texture.TextureFilter.MipMapLinearLinear, Texture.TextureFilter.Linear);
|
||||
textures.put(f12.path(), tf12);
|
||||
Forge.hdstart = true;
|
||||
} else { Forge.hdstart = false; }
|
||||
//update colors
|
||||
for (final FSkinColor.Colors c : FSkinColor.Colors.values()) {
|
||||
c.setColor(new Color(preferredIcons.getPixel(c.getX(), c.getY())));
|
||||
|
||||
@@ -229,6 +229,9 @@ public enum FSkinImage implements FImage {
|
||||
BTN_DISABLED_CENTER (FSkinProp.IMG_BTN_DISABLED_CENTER, SourceFile.ICONS),
|
||||
BTN_DISABLED_RIGHT (FSkinProp.IMG_BTN_DISABLED_RIGHT, SourceFile.ICONS),
|
||||
//Hdbuttons
|
||||
HDBTN_START_UP (FSkinProp.IMG_HDBTN_START_UP, SourceFile.BTNSTART),
|
||||
HDBTN_START_OVER (FSkinProp.IMG_HDBTN_START_OVER, SourceFile.BTNSTART),
|
||||
HDBTN_START_DOWN (FSkinProp.IMG_HDBTN_START_DOWN, SourceFile.BTNSTART),
|
||||
HDBTN_UP_LEFT (FSkinProp.IMG_HDBTN_UP_LEFT, SourceFile.BUTTONS),
|
||||
HDBTN_UP_CENTER (FSkinProp.IMG_HDBTN_UP_CENTER, SourceFile.BUTTONS),
|
||||
HDBTN_UP_RIGHT (FSkinProp.IMG_HDBTN_UP_RIGHT, SourceFile.BUTTONS),
|
||||
@@ -332,6 +335,7 @@ public enum FSkinImage implements FImage {
|
||||
ABILITIES(ForgeConstants.SPRITE_ABILITY_FILE),
|
||||
BORDERS(ForgeConstants.SPRITE_BORDER_FILE),
|
||||
BUTTONS(ForgeConstants.SPRITE_BUTTONS_FILE),
|
||||
BTNSTART(ForgeConstants.SPRITE_START_FILE),
|
||||
MANAICONS(ForgeConstants.SPRITE_MANAICONS_FILE),
|
||||
PLANAR_CONQUEST(ForgeConstants.SPRITE_PLANAR_CONQUEST_FILE);
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import forge.util.Utils;
|
||||
|
||||
public abstract class LaunchScreen extends FScreen {
|
||||
private static final float MAX_START_BUTTON_HEIGHT = 2 * Utils.AVG_FINGER_HEIGHT;
|
||||
private static final float START_BUTTON_RATIO = FSkinImage.BTN_START_UP.getWidth() / FSkinImage.BTN_START_UP.getHeight();
|
||||
private float START_BUTTON_RATIO = 0.f;
|
||||
private static final float PADDING = FOptionPane.PADDING;
|
||||
|
||||
protected final StartButton btnStart = add(new StartButton());
|
||||
@@ -26,6 +26,11 @@ public abstract class LaunchScreen extends FScreen {
|
||||
|
||||
@Override
|
||||
protected final void doLayout(float startY, float width, float height) {
|
||||
if (Forge.hdstart)
|
||||
START_BUTTON_RATIO = FSkinImage.HDBTN_START_UP.getWidth() / FSkinImage.HDBTN_START_UP.getHeight();
|
||||
else
|
||||
START_BUTTON_RATIO = FSkinImage.BTN_START_UP.getWidth() / FSkinImage.BTN_START_UP.getHeight();
|
||||
|
||||
float buttonWidth = width - 2 * PADDING;
|
||||
float buttonHeight = buttonWidth / START_BUTTON_RATIO;
|
||||
if (buttonHeight > MAX_START_BUTTON_HEIGHT) {
|
||||
@@ -72,8 +77,12 @@ public abstract class LaunchScreen extends FScreen {
|
||||
|
||||
@Override
|
||||
public void draw(Graphics g) {
|
||||
g.drawImage(pressed ? FSkinImage.BTN_START_DOWN : FSkinImage.BTN_START_UP,
|
||||
if (Forge.hdstart)
|
||||
g.drawImage(pressed ? FSkinImage.HDBTN_START_DOWN : FSkinImage.HDBTN_START_UP,
|
||||
0, 0, getWidth(), getHeight());
|
||||
else
|
||||
g.drawImage(pressed ? FSkinImage.BTN_START_DOWN : FSkinImage.BTN_START_UP,
|
||||
0, 0, getWidth(), getHeight());
|
||||
//its must be enabled or you can't start any game modes
|
||||
if (!Forge.isLoadingaMatch()) {
|
||||
if(!btnStart.isEnabled())
|
||||
|
||||
BIN
forge-gui/res/skins/default/sprite_start.png
Normal file
BIN
forge-gui/res/skins/default/sprite_start.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 142 KiB |
@@ -285,6 +285,9 @@ public enum FSkinProp {
|
||||
IMG_BTN_DISABLED_CENTER (new int[] {120, 200, 1, 40}, PropType.ICON),
|
||||
IMG_BTN_DISABLED_RIGHT (new int[] {160, 200, 40, 40}, PropType.ICON),
|
||||
//hd buttons
|
||||
IMG_HDBTN_START_UP (new int[] {2, 2, 588, 312}, PropType.BTNSTART),
|
||||
IMG_HDBTN_START_OVER (new int[] {1183, 2, 588, 312}, PropType.BTNSTART),
|
||||
IMG_HDBTN_START_DOWN (new int[] {593, 2, 588, 312}, PropType.BTNSTART),
|
||||
IMG_HDBTN_UP_LEFT (new int[] {2, 2, 160, 165}, PropType.BUTTONS),
|
||||
IMG_HDBTN_UP_CENTER (new int[] {162, 2, 1, 165}, PropType.BUTTONS),
|
||||
IMG_HDBTN_UP_RIGHT (new int[] {322, 2, 160, 165}, PropType.BUTTONS),
|
||||
@@ -398,6 +401,7 @@ public enum FSkinProp {
|
||||
ABILITY,
|
||||
BORDERS,
|
||||
BUTTONS,
|
||||
BTNSTART,
|
||||
MANAICONS,
|
||||
PLANAR_CONQUEST,
|
||||
FAVICON
|
||||
|
||||
@@ -95,11 +95,12 @@ public final class ForgeConstants {
|
||||
public static final String SPRITE_TROPHIES_FILE = "sprite_trophies.png";
|
||||
public static final String SPRITE_ABILITY_FILE = "sprite_ability.png";
|
||||
public static final String SPRITE_BORDER_FILE = "sprite_border.png";
|
||||
public static final String SPRITE_BUTTONS_FILE = "sprite_buttons.png";
|
||||
public static final String SPRITE_BUTTONS_FILE = "sprite_buttons.png";
|
||||
public static final String SPRITE_START_FILE = "sprite_start.png";
|
||||
public static final String SPRITE_MANAICONS_FILE = "sprite_manaicons.png";
|
||||
public static final String SPRITE_AVATARS_FILE = "sprite_avatars.png";
|
||||
public static final String SPRITE_SLEEVES_FILE = "sprite_sleeves.png";
|
||||
public static final String SPRITE_SLEEVES2_FILE = "sprite_sleeves2.png";
|
||||
public static final String SPRITE_SLEEVES2_FILE = "sprite_sleeves2.png";
|
||||
public static final String SPRITE_FAVICONS_FILE = "sprite_favicons.png";
|
||||
public static final String SPRITE_PLANAR_CONQUEST_FILE = "sprite_planar_conquest.png";
|
||||
public static final String FONT_FILE = "font1.ttf";
|
||||
|
||||
Reference in New Issue
Block a user