mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
Improve rendering of basic lands
This commit is contained in:
@@ -22,7 +22,6 @@ import com.badlogic.gdx.graphics.Pixmap.Format;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.cache.CacheLoader.InvalidCacheLoadException;
|
||||
|
||||
import forge.ImageKeys;
|
||||
import forge.game.card.Card;
|
||||
|
||||
@@ -103,7 +103,7 @@ final class ImageLoader extends CacheLoader<String, Texture> {
|
||||
idx--;
|
||||
}
|
||||
if (dotIdx > idx) {
|
||||
artIndex = Integer.parseInt(cardName.substring(dotIdx, idx));
|
||||
artIndex = Integer.parseInt(cardName.substring(idx, dotIdx));
|
||||
}
|
||||
cardName = cardName.substring(0, idx);
|
||||
}
|
||||
|
||||
@@ -175,6 +175,30 @@ public class CardImageRenderer {
|
||||
}
|
||||
renderer.drawRect(BORDER_THICKNESS, Color.BLACK, x, y, w, h);
|
||||
|
||||
if (card.isBasicLand()) {
|
||||
//draw icons for basic lands
|
||||
FSkinImage image;
|
||||
switch (card.getName()) {
|
||||
case "Plains":
|
||||
image = FSkinImage.MANA_W;
|
||||
break;
|
||||
case "Island":
|
||||
image = FSkinImage.MANA_U;
|
||||
break;
|
||||
case "Swamp":
|
||||
image = FSkinImage.MANA_B;
|
||||
break;
|
||||
case "Mountain":
|
||||
image = FSkinImage.MANA_R;
|
||||
break;
|
||||
default:
|
||||
image = FSkinImage.MANA_G;
|
||||
break;
|
||||
}
|
||||
float iconSize = h * 0.75f;
|
||||
renderer.drawImage(image, x + (w - iconSize) / 2, y + (h - iconSize) / 2, iconSize, iconSize);
|
||||
}
|
||||
else {
|
||||
float padding = TEXT_FONT.getCapHeight() * 0.75f;
|
||||
x += padding;
|
||||
y += padding;
|
||||
@@ -184,6 +208,7 @@ public class CardImageRenderer {
|
||||
text = text.replace("\\n", "\n"); //replace new line placeholders with actual new line characters
|
||||
cardTextRenderer.drawText(renderer, text, TEXT_FONT, Color.BLACK, x, y, w, h, y, h, true, HAlignment.LEFT, true);
|
||||
}
|
||||
}
|
||||
|
||||
private static void drawPtBox(TextureRenderer renderer, Card card, Color color1, Color color2, float x, float y, float w, float h) {
|
||||
List<String> pieces = new ArrayList<String>();
|
||||
|
||||
Reference in New Issue
Block a user