fix classic module crop on "art" mode

This commit is contained in:
Anthony Calosa
2021-09-04 10:47:22 +08:00
parent 0457ae605d
commit 9c6f21adb4
3 changed files with 21 additions and 1 deletions

View File

@@ -7,6 +7,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import forge.ImageKeys;
import forge.localinstance.properties.ForgeConstants;
import forge.util.FileUtil;
import org.apache.commons.lang3.StringUtils;
import com.badlogic.gdx.Gdx;
@@ -195,6 +198,7 @@ public class CardRenderer {
private static final Map<String, FImageComplex> cardArtCache = new HashMap<>(1024);
public static final float CARD_ART_RATIO = 1.302f;
public static final float CARD_ART_HEIGHT_PERCENTAGE = 0.43f;
private static List<String> classicModuleCardtoCrop = FileUtil.readFile(ForgeConstants.CLASSIC_MODULE_CARD_TO_CROP_FILE);
public static void clearcardArtCache(){
cardArtCache.clear();
@@ -217,6 +221,7 @@ public class CardRenderer {
public static FImageComplex getCardArt(String imageKey, boolean isSplitCard, boolean isHorizontalCard, boolean isAftermathCard, boolean isSaga, boolean isClass, boolean isDungeon, boolean isFlipCard, boolean isPlanesWalker) {
FImageComplex cardArt = cardArtCache.get(imageKey);
boolean isClassicModule = classicModuleCardtoCrop.contains(imageKey.substring(ImageKeys.CARD_PREFIX.length()).replace(".jpg","").replace(".png", ""));
if (cardArt == null) {
Texture image = new RendererCachedCardImage(imageKey, true).getImage();
if (image != null) {
@@ -227,7 +232,12 @@ public class CardRenderer {
float x, y;
float w = image.getWidth();
float h = image.getHeight();
if (isPlanesWalker) {
if (isClassicModule) {
x = w * 0.09f;
y = h * 0.2f;
w -= 2f * x;
h -= 3f * y;
}else if (isPlanesWalker) {
x = w * 0.09f;
y = h * 0.11f;
w -= 2f * x;

View File

@@ -0,0 +1,9 @@
Treasure Vault|AFR|2
Temple of the Dragon Queen|AFR|2
Lair of the Hydra|AFR|2
Hive of the Eye Tyrant|AFR|2
Hall of Storm Giants|AFR|2
Evolving Wilds|AFR|2
Dungeon Descent|AFR|2
Den of the Bugbear|AFR|2
Cave of the Frost Dragon|AFR|2

View File

@@ -52,6 +52,7 @@ public final class ForgeConstants {
public static final String NET_DECKS_OATHBREAKER_LIST_FILE = LISTS_DIR + "net-decks-oathbreaker.txt";
public static final String NET_DECKS_TINYLEADERS_LIST_FILE = LISTS_DIR + "net-decks-tinyleaders.txt";
public static final String BORDERLESS_CARD_LIST_FILE = LISTS_DIR + "borderlessCardList.txt";
public static final String CLASSIC_MODULE_CARD_TO_CROP_FILE = LISTS_DIR + "classicModuleCardtoCrop.txt";
public static final String SKINS_LIST_FILE = LISTS_DIR + "skinsList.txt";
public static final String CJK_FONTS_LIST_FILE = LISTS_DIR + "font-list.txt";
public static final String NET_ARCHIVE_STANDARD_DECKS_LIST_FILE = LISTS_DIR + "net-decks-archive-standard.txt";