Improve rendering of basic lands

This commit is contained in:
drdev
2014-07-28 02:09:45 +00:00
parent 425ebeadeb
commit a63e8419f2
3 changed files with 34 additions and 10 deletions

View File

@@ -22,7 +22,6 @@ import com.badlogic.gdx.graphics.Pixmap.Format;
import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.Texture;
import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheBuilder;
import com.google.common.cache.LoadingCache; import com.google.common.cache.LoadingCache;
import com.google.common.cache.CacheLoader.InvalidCacheLoadException;
import forge.ImageKeys; import forge.ImageKeys;
import forge.game.card.Card; import forge.game.card.Card;

View File

@@ -103,7 +103,7 @@ final class ImageLoader extends CacheLoader<String, Texture> {
idx--; idx--;
} }
if (dotIdx > idx) { if (dotIdx > idx) {
artIndex = Integer.parseInt(cardName.substring(dotIdx, idx)); artIndex = Integer.parseInt(cardName.substring(idx, dotIdx));
} }
cardName = cardName.substring(0, idx); cardName = cardName.substring(0, idx);
} }

View File

@@ -175,14 +175,39 @@ public class CardImageRenderer {
} }
renderer.drawRect(BORDER_THICKNESS, Color.BLACK, x, y, w, h); renderer.drawRect(BORDER_THICKNESS, Color.BLACK, x, y, w, h);
float padding = TEXT_FONT.getCapHeight() * 0.75f; if (card.isBasicLand()) {
x += padding; //draw icons for basic lands
y += padding; FSkinImage image;
w -= 2 * padding; switch (card.getName()) {
h -= 2 * padding; case "Plains":
String text = card.getRules().getOracleText(); image = FSkinImage.MANA_W;
text = text.replace("\\n", "\n"); //replace new line placeholders with actual new line characters break;
cardTextRenderer.drawText(renderer, text, TEXT_FONT, Color.BLACK, x, y, w, h, y, h, true, HAlignment.LEFT, true); 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;
w -= 2 * padding;
h -= 2 * padding;
String text = card.getRules().getOracleText();
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) { private static void drawPtBox(TextureRenderer renderer, Card card, Color color1, Color color2, float x, float y, float w, float h) {