mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
prevent NPE
This commit is contained in:
@@ -37,6 +37,7 @@ import forge.assets.FRotatedImage;
|
||||
import forge.assets.FSkin;
|
||||
import forge.assets.FSkinColor;
|
||||
import forge.assets.FSkinFont;
|
||||
import forge.assets.FSkinImageInterface;
|
||||
import forge.assets.FTextureRegionImage;
|
||||
import forge.assets.ImageCache;
|
||||
import forge.card.CardZoom.ActivateHandler;
|
||||
@@ -93,13 +94,22 @@ public class CardRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
private static float calcSymbolSize(FSkinProp skinProp) {
|
||||
if (skinProp == null)
|
||||
return 0f;
|
||||
FSkinImageInterface image = FSkin.getImages().get(skinProp);
|
||||
if (image == null)
|
||||
return 0f;
|
||||
return image.getNearestHQWidth(2 * (NAME_FONT.getCapHeight() - MANA_COST_PADDING));
|
||||
}
|
||||
|
||||
private static final FSkinFont NAME_FONT = FSkinFont.get(16);
|
||||
public static final float NAME_BOX_TINT = 0.2f;
|
||||
public static final float TEXT_BOX_TINT = 0.1f;
|
||||
public static final float PT_BOX_TINT = 0.2f;
|
||||
private static final float MANA_COST_PADDING = Utils.scale(3);
|
||||
public static final float SET_BOX_MARGIN = Utils.scale(1);
|
||||
public static final float MANA_SYMBOL_SIZE = FSkin.getImages().get(FSkinProp.IMG_MANA_1).getNearestHQWidth(2 * (NAME_FONT.getCapHeight() - MANA_COST_PADDING));
|
||||
public static final float MANA_SYMBOL_SIZE = calcSymbolSize(FSkinProp.IMG_MANA_1);
|
||||
private static final float NAME_COST_THRESHOLD = Utils.scale(200);
|
||||
private static final float BORDER_THICKNESS = Utils.scale(1);
|
||||
public static final float PADDING_MULTIPLIER = 0.021f;
|
||||
|
||||
Reference in New Issue
Block a user