mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
[Mobile] Border Mask Option
- Full > cards have round corners (both .fullborder and .full cards) - Crop > .fullborder cards will be cropped to look like .full cards - Off > no changes (for user who use png images use Off)
This commit is contained in:
@@ -65,7 +65,7 @@ public class Forge implements ApplicationListener {
|
||||
private static boolean isloadingaMatch = false;
|
||||
public static boolean showFPS = false;
|
||||
public static boolean altPlayerLayout = false;
|
||||
public static boolean enableUIMask = false;
|
||||
public static String enableUIMask = "Crop";
|
||||
public static boolean enablePreloadExtendedArt = false;
|
||||
public static boolean isTabletDevice = false;
|
||||
public static String locale = "en-US";
|
||||
@@ -130,7 +130,11 @@ public class Forge implements ApplicationListener {
|
||||
textureFiltering = prefs.getPrefBoolean(FPref.UI_LIBGDX_TEXTURE_FILTERING);
|
||||
showFPS = prefs.getPrefBoolean(FPref.UI_SHOW_FPS);
|
||||
altPlayerLayout = prefs.getPrefBoolean(FPref.UI_ALT_PLAYERINFOLAYOUT);
|
||||
enableUIMask = prefs.getPrefBoolean(FPref.UI_ENABLE_BORDER_MASKING);
|
||||
enableUIMask = prefs.getPref(FPref.UI_ENABLE_BORDER_MASKING);
|
||||
if (prefs.getPref(FPref.UI_ENABLE_BORDER_MASKING).equals("true")) //override old settings if not updated
|
||||
enableUIMask = "Full";
|
||||
else if (prefs.getPref(FPref.UI_ENABLE_BORDER_MASKING).equals("false"))
|
||||
enableUIMask = "Off";
|
||||
enablePreloadExtendedArt = prefs.getPrefBoolean(FPref.UI_ENABLE_PRELOAD_EXTENDED_ART);
|
||||
locale = prefs.getPref(FPref.UI_LANGUAGE);
|
||||
autoCache = prefs.getPrefBoolean(FPref.UI_AUTO_CACHE_SIZE);
|
||||
|
||||
@@ -27,7 +27,7 @@ final class ImageLoader extends CacheLoader<String, Texture> {
|
||||
Texture n;
|
||||
@Override
|
||||
public Texture load(String key) {
|
||||
boolean extendedArt = isBorderless(key);
|
||||
boolean extendedArt = isBorderless(key) && Forge.enableUIMask.equals("Full");
|
||||
boolean textureFilter = Forge.isTextureFilteringEnabled();
|
||||
File file = ImageKeys.getImageFile(key);
|
||||
if (file != null) {
|
||||
|
||||
@@ -37,7 +37,7 @@ public class CardImage implements FImage {
|
||||
if (image == null) { //attempt to retrieve card image if needed
|
||||
image = ImageCache.getImage(card);
|
||||
if (image == null) {
|
||||
if (Forge.enableUIMask) //render this if mask is still loading
|
||||
if (!Forge.enableUIMask.equals("Off")) //render this if mask is still loading
|
||||
CardImageRenderer.drawCardImage(g, CardView.getCardForUi(card), false, x, y, w, h, CardStackPosition.Top);
|
||||
|
||||
return; //can't draw anything if can't be loaded yet
|
||||
@@ -48,7 +48,7 @@ public class CardImage implements FImage {
|
||||
CardImageRenderer.drawCardImage(g, CardView.getCardForUi(card), false, x, y, w, h, CardStackPosition.Top);
|
||||
}
|
||||
else {
|
||||
if (Forge.enableUIMask) {
|
||||
if (Forge.enableUIMask.equals("Full")) {
|
||||
if (ImageCache.isBorderlessCardArt(image))
|
||||
g.drawImage(image, x, y, w, h);
|
||||
else {
|
||||
@@ -56,8 +56,9 @@ public class CardImage implements FImage {
|
||||
g.drawborderImage(ImageCache.borderColor(image), x, y, w, h);
|
||||
g.drawImage(ImageCache.croppedBorderImage(image), x+radius/2.2f, y+radius/2, w*0.96f, h*0.96f);
|
||||
}
|
||||
}
|
||||
else
|
||||
} else if (Forge.enableUIMask.equals("Crop")) {
|
||||
g.drawImage(ImageCache.croppedBorderImage(image), x, y, w, h);
|
||||
} else
|
||||
g.drawImage(image, x, y, w, h);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -379,34 +379,40 @@ public class CardImageRenderer {
|
||||
minusxy = 0.135f*radius;
|
||||
}
|
||||
if (rotatePlane && (card.getCurrentState().isPhenomenon() || card.getCurrentState().isPlane())) {
|
||||
if (Forge.enableUIMask){
|
||||
if (Forge.enableUIMask.equals("Full")){
|
||||
if (ImageCache.isBorderlessCardArt(image))
|
||||
g.drawRotatedImage(image, new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, -90);
|
||||
else {
|
||||
g.drawRotatedImage(FSkin.getBorders().get(0), new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, -90);
|
||||
g.drawRotatedImage(ImageCache.croppedBorderImage(image), new_x+radius/2-minusxy, new_y+radius/2-minusxy, new_w*croppedArea, new_h*croppedArea, (new_x+radius/2-minusxy) + (new_w*croppedArea) / 2, (new_y+radius/2-minusxy) + (new_h*croppedArea) / 2, -90);
|
||||
}
|
||||
} else if (Forge.enableUIMask.equals("Crop")) {
|
||||
g.drawRotatedImage(ImageCache.croppedBorderImage(image), new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, -90);
|
||||
} else
|
||||
g.drawRotatedImage(image, new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, -90);
|
||||
} else if (rotateSplit && isCurrentCard && card.isSplitCard() && canshow) {
|
||||
boolean isAftermath = card.getText().contains("Aftermath") || card.getAlternateState().getOracleText().contains("Aftermath");
|
||||
if (Forge.enableUIMask) {
|
||||
if (Forge.enableUIMask.equals("Full")) {
|
||||
if (ImageCache.isBorderlessCardArt(image))
|
||||
g.drawRotatedImage(image, new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, isAftermath ? 90 : -90);
|
||||
else {
|
||||
g.drawRotatedImage(FSkin.getBorders().get(ImageCache.getFSkinBorders(card)), new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, isAftermath ? 90 : -90);
|
||||
g.drawRotatedImage(ImageCache.croppedBorderImage(image), new_x + radius / 2-minusxy, new_y + radius / 2-minusxy, new_w * croppedArea, new_h * croppedArea, (new_x + radius / 2-minusxy) + (new_w * croppedArea) / 2, (new_y + radius / 2-minusxy) + (new_h * croppedArea) / 2, isAftermath ? 90 : -90);
|
||||
}
|
||||
} else if (Forge.enableUIMask.equals("Crop")) {
|
||||
g.drawRotatedImage(ImageCache.croppedBorderImage(image), new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, isAftermath ? 90 : -90);
|
||||
} else
|
||||
g.drawRotatedImage(image, new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, isAftermath ? 90 : -90);
|
||||
} else {
|
||||
if (Forge.enableUIMask && canshow) {
|
||||
if (Forge.enableUIMask.equals("Full") && canshow) {
|
||||
if (ImageCache.isBorderlessCardArt(image))
|
||||
g.drawImage(image, x, y, w, h);
|
||||
else {
|
||||
g.drawImage(ImageCache.getBorderImage(image.toString()), ImageCache.borderColor(image), x, y, w, h);
|
||||
g.drawImage(ImageCache.croppedBorderImage(image), x + radius / 2.4f-minusxy, y + radius / 2-minusxy, w * croppedArea, h * croppedArea);
|
||||
}
|
||||
} else if (Forge.enableUIMask.equals("Crop") && canshow) {
|
||||
g.drawImage(ImageCache.croppedBorderImage(image), x, y, w, h);
|
||||
} else {
|
||||
if (canshow)
|
||||
g.drawImage(image, x, y, w, h);
|
||||
|
||||
@@ -457,7 +457,7 @@ public class CardRenderer {
|
||||
if (image == ImageCache.defaultImage) {
|
||||
CardImageRenderer.drawCardImage(g, CardView.getCardForUi(pc), false, x, y, w, h, pos);
|
||||
} else {
|
||||
if (Forge.enableUIMask) {
|
||||
if (Forge.enableUIMask.equals("Full")) {
|
||||
if (ImageCache.isBorderlessCardArt(image))
|
||||
g.drawImage(image, x, y, w, h);
|
||||
else {
|
||||
@@ -465,6 +465,8 @@ public class CardRenderer {
|
||||
g.drawImage(ImageCache.getBorderImage(image.toString()), ImageCache.borderColor(image), x, y, w, h);
|
||||
g.drawImage(ImageCache.croppedBorderImage(image), x + radius / 2.4f-minusxy, y + radius / 2-minusxy, w * croppedArea, h * croppedArea);
|
||||
}
|
||||
} else if (Forge.enableUIMask.equals("Crop")) {
|
||||
g.drawImage(ImageCache.croppedBorderImage(image), x, y, w, h);
|
||||
} else
|
||||
g.drawImage(image, x, y, w, h);
|
||||
}
|
||||
@@ -476,7 +478,7 @@ public class CardRenderer {
|
||||
drawFoilEffect(g, card, x, y, w, h, false);
|
||||
}
|
||||
} else {
|
||||
if (Forge.enableUIMask) //render this if mask is still loading
|
||||
if (!Forge.enableUIMask.equals("Off")) //render this if mask is still loading
|
||||
CardImageRenderer.drawCardImage(g, CardView.getCardForUi(pc), false, x, y, w, h, pos);
|
||||
else //draw cards without textures as just a black rectangle
|
||||
g.fillRect(Color.BLACK, x, y, w, h);
|
||||
@@ -505,17 +507,19 @@ public class CardRenderer {
|
||||
} else {
|
||||
if(FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_ROTATE_PLANE_OR_PHENOMENON)
|
||||
&& (card.getCurrentState().isPhenomenon() || card.getCurrentState().isPlane()) && rotate){
|
||||
if (Forge.enableUIMask) {
|
||||
if (Forge.enableUIMask.equals("Full")) {
|
||||
if (ImageCache.isBorderlessCardArt(image))
|
||||
g.drawRotatedImage(image, x, y, w, h, x + w / 2, y + h / 2, -90);
|
||||
else {
|
||||
g.drawRotatedImage(FSkin.getBorders().get(0), x, y, w, h, x + w / 2, y + h / 2, -90);
|
||||
g.drawRotatedImage(ImageCache.croppedBorderImage(image), x+radius/2.3f-minusxy, y+radius/2-minusxy, w*croppedArea, h*croppedArea, (x+radius/2.3f-minusxy) + (w*croppedArea) / 2, (y+radius/2-minusxy) + (h*croppedArea) / 2, -90);
|
||||
}
|
||||
} else if (Forge.enableUIMask.equals("Crop")) {
|
||||
g.drawRotatedImage(ImageCache.croppedBorderImage(image),x, y, w, h, x + w / 2, y + h / 2, -90);
|
||||
} else
|
||||
g.drawRotatedImage(image, x, y, w, h, x + w / 2, y + h / 2, -90);
|
||||
} else {
|
||||
if (Forge.enableUIMask && canshow) {
|
||||
if (Forge.enableUIMask.equals("Full") && canshow) {
|
||||
if (ImageCache.isBorderlessCardArt(image))
|
||||
g.drawImage(image, x, y, w, h);
|
||||
else {
|
||||
@@ -523,6 +527,8 @@ public class CardRenderer {
|
||||
g.drawBorderImage(ImageCache.getBorderImage(image.toString(), canshow), ImageCache.borderColor(image), ImageCache.getTint(card, image), x, y, w, h, t); //tint check for changed colors
|
||||
g.drawImage(ImageCache.croppedBorderImage(image), x + radius / 2.4f-minusxy, y + radius / 2-minusxy, w * croppedArea, h * croppedArea);
|
||||
}
|
||||
} else if (Forge.enableUIMask.equals("Crop") && canshow) {
|
||||
g.drawImage(ImageCache.croppedBorderImage(image), x, y, w, h);
|
||||
} else {
|
||||
if (canshow)
|
||||
g.drawImage(image, x, y, w, h);
|
||||
@@ -533,7 +539,7 @@ public class CardRenderer {
|
||||
}
|
||||
drawFoilEffect(g, card, x, y, w, h, false);
|
||||
} else {
|
||||
if (Forge.enableUIMask) //render this if mask is still loading
|
||||
if (!Forge.enableUIMask.equals("Off")) //render this if mask is still loading
|
||||
CardImageRenderer.drawCardImage(g, card, false, x, y, w, h, pos);
|
||||
else //draw cards without textures as just a black rectangle
|
||||
g.fillRect(Color.BLACK, x, y, w, h);
|
||||
@@ -1140,7 +1146,7 @@ public class CardRenderer {
|
||||
croppedArea = 0.975f;
|
||||
minusxy = 0.135f*radius;
|
||||
}
|
||||
if (Forge.enableUIMask) {
|
||||
if (Forge.enableUIMask.equals("Full")) {
|
||||
new_x += radius/2.4f-minusxy; new_y += radius/2-minusxy; new_w = w * croppedArea; new_h = h * croppedArea;
|
||||
}
|
||||
if (isPreferenceEnabled(FPref.UI_OVERLAY_FOIL_EFFECT) && MatchController.instance.mayView(card)) {
|
||||
|
||||
@@ -986,7 +986,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
||||
if (selected) {
|
||||
if (!deckSelectMode) {
|
||||
//if round border is enabled, the select highlight is also rounded..
|
||||
if (Forge.enableUIMask) {
|
||||
if (Forge.enableUIMask.equals("Full")) {
|
||||
//fillroundrect has rough/aliased corner
|
||||
g.fillRoundRect(Color.GREEN, x - SEL_BORDER_SIZE, y - SEL_BORDER_SIZE, w + 2 * SEL_BORDER_SIZE, h + 2 * SEL_BORDER_SIZE, (h - w) / 10);
|
||||
//drawroundrect has GL_SMOOTH to `smoothen/faux` the aliased corner
|
||||
@@ -1007,7 +1007,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
||||
float scale = 0.75f;
|
||||
|
||||
if (dpImg != null) {//generated decks have missing info...
|
||||
if (Forge.enableUIMask){
|
||||
if (Forge.enableUIMask.equals("Full")){
|
||||
//commander bg
|
||||
g.drawImage(FSkin.getDeckbox().get(0), FSkin.getDeckbox().get(0), x, y, w, h, Color.GREEN, selected);
|
||||
TextureRegion tr = ImageCache.croppedBorderImage(dpImg);
|
||||
|
||||
@@ -366,16 +366,16 @@ public class SettingsPage extends TabPage<SettingsScreen> {
|
||||
localizer.getMessage("lblDisableCardEffect"),
|
||||
localizer.getMessage("nlDisableCardEffect")),
|
||||
4);
|
||||
lstSettings.addItem(new BooleanSetting(FPref.UI_ENABLE_BORDER_MASKING,
|
||||
localizer.getMessage("lblEnableRoundBorder"),
|
||||
localizer.getMessage("nlEnableRoundBorder")){
|
||||
lstSettings.addItem(new CustomSelectSetting(FPref.UI_ENABLE_BORDER_MASKING,
|
||||
localizer.getMessage("lblBorderMaskOption"),
|
||||
localizer.getMessage("nlBorderMaskOption"),
|
||||
new String[]{"Off", "Crop", "Full"}) {
|
||||
@Override
|
||||
public void select() {
|
||||
super.select();
|
||||
//update
|
||||
Forge.enableUIMask = FModel.getPreferences().getPrefBoolean(FPref.UI_ENABLE_BORDER_MASKING);
|
||||
public void valueChanged(String newValue) {
|
||||
super.valueChanged(newValue);
|
||||
Forge.enableUIMask = FModel.getPreferences().getPref(FPref.UI_ENABLE_BORDER_MASKING);
|
||||
}
|
||||
},4);
|
||||
}, 4);
|
||||
lstSettings.addItem(new BooleanSetting(FPref.UI_ENABLE_PRELOAD_EXTENDED_ART,
|
||||
localizer.getMessage("lblPreloadExtendedArtCards"),
|
||||
localizer.getMessage("nlPreloadExtendedArtCards")){
|
||||
|
||||
@@ -992,6 +992,8 @@ nlShowMatchBackground=Zeige Bilder im Spielfeldhintergrund.
|
||||
nlTheme=Wähle ein Thema um die Bildschirmanzeigen anzupassen.
|
||||
nlVibrateAfterLongPress=Aktiviert Vibration bei langem Druck, z.B. beim Zoomen.
|
||||
nlVibrateWhenLosingLife=Aktiviert Vibration bei Lebenspunktverlust.
|
||||
lblBorderMaskOption=Border Mask Option
|
||||
nlBorderMaskOption=Applies the selected border option for card images (If unsure, choose Crop).
|
||||
lblEnableRoundBorder=Aktiviere Maske mit runden Ränder
|
||||
nlEnableRoundBorder=Wenn aktiviert, werden Kartenecken abgerundet. Vorzugsweise bei Karten mit vollem Rand.
|
||||
lblPreloadExtendedArtCards=Erw. Kartenbilder bei Start laden
|
||||
|
||||
@@ -992,6 +992,8 @@ nlShowMatchBackground=Show match background image on battlefield, otherwise back
|
||||
nlTheme=Sets the theme that determines how display components are skinned.
|
||||
nlVibrateAfterLongPress=Enable quick vibration to signify a long press, such as for card zooming.
|
||||
nlVibrateWhenLosingLife=Enable vibration when your player loses life or takes damage during a game.
|
||||
lblBorderMaskOption=Border Mask Option
|
||||
nlBorderMaskOption=Applies the selected border option for card images (If unsure, choose Crop).
|
||||
lblEnableRoundBorder=Enable Round Border Mask
|
||||
nlEnableRoundBorder=When enabled, the card corners are rounded (Preferably Card with Full Borders).
|
||||
lblPreloadExtendedArtCards=Preload Extended Art Cards
|
||||
|
||||
@@ -992,6 +992,8 @@ nlShowMatchBackground=Muestra la imagen de fondo de la partida en el campo de ba
|
||||
nlTheme=Establece el tema que determina el aspecto global del juego.
|
||||
nlVibrateAfterLongPress=Habilita la vibración rápida cuando se realice una pulsación prolongada, como p.ej. al realizar zoom de la carta.
|
||||
nlVibrateWhenLosingLife=Habilita la vibración cuando tu jugador pierde vidas o sufre daños durante un juego.
|
||||
lblBorderMaskOption=Border Mask Option
|
||||
nlBorderMaskOption=Applies the selected border option for card images (If unsure, choose Crop).
|
||||
lblEnableRoundBorder=Habilitar máscara de bordes redondeados
|
||||
nlEnableRoundBorder=Cuando está habilitado, las esquinas de las cartas se redondean (Preferiblemente Cartas con bordes completos).
|
||||
lblPreloadExtendedArtCards=Precargar Cartas de Arte Extendido
|
||||
|
||||
@@ -992,6 +992,8 @@ nlShowMatchBackground=Mostra l''immagine di sfondo della partita sul campo di ba
|
||||
nlTheme=Imposta il tema che determina la modalità di skin dei componenti di visualizzazione.
|
||||
nlVibrateAfterLongPress=Abilitare la vibrazione rapida per indicare una pressione prolungata, ad esempio per lo zoom della scheda.
|
||||
nlVibrateWhenLosingLife=Attiva le vibrazioni quando il giocatore perde punti vita o subisce danni durante una partita.
|
||||
lblBorderMaskOption=Border Mask Option
|
||||
nlBorderMaskOption=Applies the selected border option for card images (If unsure, choose Crop).
|
||||
lblEnableRoundBorder=Abilita maschera bordo arrotondato
|
||||
nlEnableRoundBorder=Se abilitato, gli angoli delle carte sono arrotondati (preferibilmente Carta con bordi pieni).
|
||||
lblPreloadExtendedArtCards=Carte d''arte estese precaricate
|
||||
|
||||
@@ -992,6 +992,8 @@ nlShowMatchBackground=Show match background image on battlefield, otherwise back
|
||||
nlTheme=表示コンポーネントのスキニング方法を決定するテーマを設定します。
|
||||
nlVibrateAfterLongPress=Enable quick vibration to signify a long press, such as for card zooming.
|
||||
nlVibrateWhenLosingLife=プレーヤーがゲーム中に命を失ったり、ダメージを受けたりしたときにバイブレーションを有効にします。
|
||||
lblBorderMaskOption=Border Mask Option
|
||||
nlBorderMaskOption=Applies the selected border option for card images (If unsure, choose Crop).
|
||||
lblEnableRoundBorder=ラウンドボーダーマスクを有効にする
|
||||
nlEnableRoundBorder=有効にすると、カードの角は丸みを帯びます(できれば縁が完全にあるカード)
|
||||
lblPreloadExtendedArtCards=Preload Extended Art Cards
|
||||
|
||||
@@ -992,6 +992,8 @@ nlShowMatchBackground=在战场显示背景图片,否则显示背景纹理。
|
||||
nlTheme=设置显示的组件使用的外观主题。
|
||||
nlVibrateAfterLongPress=启用长按触发震动,例如长按缩放卡牌图片。
|
||||
nlVibrateWhenLosingLife=启用当玩家在游戏中失去生命或收到伤害时震动。
|
||||
lblBorderMaskOption=Border Mask Option
|
||||
nlBorderMaskOption=Applies the selected border option for card images (If unsure, choose Crop).
|
||||
lblEnableRoundBorder=启用圆角边框掩码
|
||||
nlEnableRoundBorder=启用后,卡牌边框会变成圆角(带有完整边框的卡牌图片效果最好)。
|
||||
lblPreloadExtendedArtCards=预加载拉伸卡图
|
||||
|
||||
@@ -142,7 +142,7 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
|
||||
UI_DYNAMIC_PLANECHASE_BG("false"),
|
||||
UI_DISABLE_IMAGES_EFFECT_CARDS("false"),
|
||||
UI_ENABLE_PRELOAD_EXTENDED_ART("false"),
|
||||
UI_ENABLE_BORDER_MASKING("false"),
|
||||
UI_ENABLE_BORDER_MASKING("Crop"),
|
||||
UI_SHOW_FPS("false"),
|
||||
UI_NETPLAY_COMPAT("false"),
|
||||
UI_LOAD_UNKNOWN_CARDS("true"),
|
||||
|
||||
Reference in New Issue
Block a user