Update Libgdx to 1.9.10

This commit is contained in:
kevlahnota
2019-08-23 00:59:18 +08:00
committed by Anthony Calosa
parent 47a1b6ea98
commit 5e88cc67e4
119 changed files with 379 additions and 372 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -102,7 +102,7 @@
<dependency> <dependency>
<groupId>com.badlogicgames.gdx</groupId> <groupId>com.badlogicgames.gdx</groupId>
<artifactId>gdx-backend-android</artifactId> <artifactId>gdx-backend-android</artifactId>
<version>1.5.5</version> <version>1.9.10</version>
</dependency> </dependency>
</dependencies> </dependencies>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -73,7 +73,7 @@
<dependency> <dependency>
<groupId>com.badlogicgames.gdx</groupId> <groupId>com.badlogicgames.gdx</groupId>
<artifactId>gdx-backend-robovm</artifactId> <artifactId>gdx-backend-robovm</artifactId>
<version>1.5.5</version> <version>1.9.10</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

View File

@@ -60,7 +60,7 @@
<dependency> <dependency>
<groupId>com.badlogicgames.gdx</groupId> <groupId>com.badlogicgames.gdx</groupId>
<artifactId>gdx-backend-lwjgl</artifactId> <artifactId>gdx-backend-lwjgl</artifactId>
<version>1.5.5</version> <version>1.9.10</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.badlogicgames.gdx</groupId> <groupId>com.badlogicgames.gdx</groupId>
@@ -71,7 +71,7 @@
<dependency> <dependency>
<groupId>com.badlogicgames.gdx</groupId> <groupId>com.badlogicgames.gdx</groupId>
<artifactId>gdx-freetype-platform</artifactId> <artifactId>gdx-freetype-platform</artifactId>
<version>1.5.5</version> <version>1.9.10</version>
<classifier>natives-desktop</classifier> <classifier>natives-desktop</classifier>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/commons-cli/commons-cli --> <!-- https://mvnrepository.com/artifact/commons-cli/commons-cli -->

Binary file not shown.

View File

@@ -63,12 +63,12 @@
<dependency> <dependency>
<groupId>com.badlogicgames.gdx</groupId> <groupId>com.badlogicgames.gdx</groupId>
<artifactId>gdx</artifactId> <artifactId>gdx</artifactId>
<version>1.5.5</version> <version>1.9.10</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.badlogicgames.gdx</groupId> <groupId>com.badlogicgames.gdx</groupId>
<artifactId>gdx-freetype</artifactId> <artifactId>gdx-freetype</artifactId>
<version>1.5.5</version> <version>1.9.10</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@@ -4,8 +4,6 @@ import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.graphics.g2d.BitmapFont.TextBounds;
import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
@@ -20,7 +18,7 @@ import forge.assets.FSkinColor;
import forge.assets.FSkinFont; import forge.assets.FSkinFont;
import forge.toolbox.FDisplayObject; import forge.toolbox.FDisplayObject;
import forge.util.Utils; import forge.util.Utils;
import forge.util.TextBounds;
import java.util.Stack; import java.util.Stack;
public class Graphics { public class Graphics {
@@ -602,10 +600,10 @@ public class Graphics {
batch.draw(image, adjustX(x), adjustY(y, h), originX - x, h - (originY - y), w, h, 1, 1, rotation, srcX, srcY, srcWidth, srcHeight, false, false); batch.draw(image, adjustX(x), adjustY(y, h), originX - x, h - (originY - y), w, h, 1, 1, rotation, srcX, srcY, srcWidth, srcHeight, false, false);
} }
public void drawText(String text, FSkinFont font, FSkinColor skinColor, float x, float y, float w, float h, boolean wrap, HAlignment horzAlignment, boolean centerVertically) { public void drawText(String text, FSkinFont font, FSkinColor skinColor, float x, float y, float w, float h, boolean wrap, int horzAlignment, boolean centerVertically) {
drawText(text, font, skinColor.getColor(), x, y, w, h, wrap, horzAlignment, centerVertically); drawText(text, font, skinColor.getColor(), x, y, w, h, wrap, horzAlignment, centerVertically);
} }
public void drawText(String text, FSkinFont font, Color color, float x, float y, float w, float h, boolean wrap, HAlignment horzAlignment, boolean centerVertically) { public void drawText(String text, FSkinFont font, Color color, float x, float y, float w, float h, boolean wrap, int horzAlignment, boolean centerVertically) {
if (alphaComposite < 1) { if (alphaComposite < 1) {
color = FSkinColor.alphaColor(color, color.a * alphaComposite); color = FSkinColor.alphaColor(color, color.a * alphaComposite);
} }
@@ -660,7 +658,7 @@ public class Graphics {
} }
//use nifty trick with multiple text renders to draw outlined text //use nifty trick with multiple text renders to draw outlined text
public void drawOutlinedText(String text, FSkinFont skinFont, Color textColor, Color outlineColor, float x, float y, float w, float h, boolean wrap, HAlignment horzAlignment, boolean centerVertically) { public void drawOutlinedText(String text, FSkinFont skinFont, Color textColor, Color outlineColor, float x, float y, float w, float h, boolean wrap, int horzAlignment, boolean centerVertically) {
drawText(text, skinFont, outlineColor, x - 1, y, w, h, wrap, horzAlignment, centerVertically); drawText(text, skinFont, outlineColor, x - 1, y, w, h, wrap, horzAlignment, centerVertically);
drawText(text, skinFont, outlineColor, x, y - 1, w, h, wrap, horzAlignment, centerVertically); drawText(text, skinFont, outlineColor, x, y - 1, w, h, wrap, horzAlignment, centerVertically);
drawText(text, skinFont, outlineColor, x - 1, y - 1, w, h, wrap, horzAlignment, centerVertically); drawText(text, skinFont, outlineColor, x - 1, y - 1, w, h, wrap, horzAlignment, centerVertically);

View File

@@ -8,7 +8,7 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion;
import forge.Graphics; import forge.Graphics;
public class GifAnimation extends ForgeAnimation { public class GifAnimation extends ForgeAnimation {
private final Animation animation; private final Animation<TextureRegion> animation;
private TextureRegion currentFrame; private TextureRegion currentFrame;
private float stateTime; private float stateTime;

View File

@@ -5,13 +5,8 @@ import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Pixmap; import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.*;
import com.badlogic.gdx.graphics.g2d.BitmapFont.BitmapFontData; import com.badlogic.gdx.graphics.g2d.BitmapFont.BitmapFontData;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.graphics.g2d.BitmapFont.TextBounds;
import com.badlogic.gdx.graphics.g2d.PixmapPacker;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator; import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter; import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter;
import com.badlogic.gdx.graphics.glutils.PixmapTextureData; import com.badlogic.gdx.graphics.glutils.PixmapTextureData;
@@ -19,8 +14,8 @@ import com.badlogic.gdx.utils.Array;
import forge.FThreads; import forge.FThreads;
import forge.properties.ForgeConstants; import forge.properties.ForgeConstants;
import forge.util.FileUtil; import forge.util.FileUtil;
import forge.util.TextBounds;
import forge.util.Utils; import forge.util.Utils;
import java.io.File; import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@@ -31,6 +26,7 @@ public class FSkinFont {
private static final String TTF_FILE = "font1.ttf"; private static final String TTF_FILE = "font1.ttf";
private static final Map<Integer, FSkinFont> fonts = new HashMap<Integer, FSkinFont>(); private static final Map<Integer, FSkinFont> fonts = new HashMap<Integer, FSkinFont>();
private static final GlyphLayout layout = new GlyphLayout();
static { static {
FileUtil.ensureDirectoryExists(ForgeConstants.FONTS_DIR); FileUtil.ensureDirectoryExists(ForgeConstants.FONTS_DIR);
@@ -98,15 +94,22 @@ public class FSkinFont {
// Expose methods from font that updates scale as needed // Expose methods from font that updates scale as needed
public TextBounds getBounds(CharSequence str) { public TextBounds getBounds(CharSequence str) {
updateScale(); //must update scale before measuring text updateScale(); //must update scale before measuring text
return font.getBounds(str); layout.setText(font, str);
return new TextBounds(layout.width, layout.height);
} }
public TextBounds getMultiLineBounds(CharSequence str) { public TextBounds getMultiLineBounds(CharSequence str) {
updateScale(); updateScale();
return font.getMultiLineBounds(str); layout.setText(font, str);
return new TextBounds(layout.width, layout.height);
} }
public TextBounds getWrappedBounds(CharSequence str, float wrapWidth) { public TextBounds getWrappedBounds(CharSequence str, float wrapWidth) {
updateScale(); updateScale();
return font.getWrappedBounds(str, wrapWidth); layout.setText(font, str);
layout.width = wrapWidth;
return new TextBounds(layout.width, layout.height);
} }
public float getAscent() { public float getAscent() {
updateScale(); updateScale();
@@ -121,20 +124,16 @@ public class FSkinFont {
return font.getLineHeight(); return font.getLineHeight();
} }
public void draw(SpriteBatch batch, String text, Color color, float x, float y, float w, boolean wrap, HAlignment horzAlignment) { public void draw(SpriteBatch batch, String text, Color color, float x, float y, float w, boolean wrap, int horzAlignment) {
updateScale(); updateScale();
font.setColor(color); font.setColor(color);
if (wrap) { font.draw(batch, text, x, y, w, horzAlignment, wrap);
font.drawWrapped(batch, text, x, y, w, horzAlignment);
} else {
font.drawMultiLine(batch, text, x, y, w, horzAlignment);
}
} }
//update scale of font if needed //update scale of font if needed
private void updateScale() { private void updateScale() {
if (font.getScaleX() != scale) { if (font.getScaleX() != scale) {
font.setScale(scale); font.getData().setScale(scale);
} }
} }
@@ -187,7 +186,7 @@ public class FSkinFont {
//only generate images for characters that could be used by Forge //only generate images for characters that could be used by Forge
String chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890\"!?'.,;:()[]{}<>|/@\\^$-%+=#_&*\u2014\u2022"; String chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890\"!?'.,;:()[]{}<>|/@\\^$-%+=#_&*\u2014\u2022";
chars += "ÁÉÍÓÚáéíóúÀÈÌÒÙàèìòùÑñÄËÏÖÜäëïöüẞß";
final PixmapPacker packer = new PixmapPacker(pageSize, pageSize, Pixmap.Format.RGBA8888, 2, false); final PixmapPacker packer = new PixmapPacker(pageSize, pageSize, Pixmap.Format.RGBA8888, 2, false);
final FreeTypeFontParameter parameter = new FreeTypeFontParameter(); final FreeTypeFontParameter parameter = new FreeTypeFontParameter();
parameter.characters = chars; parameter.characters = chars;
@@ -200,7 +199,7 @@ public class FSkinFont {
FThreads.invokeInEdtNowOrLater(new Runnable() { FThreads.invokeInEdtNowOrLater(new Runnable() {
@Override @Override
public void run() { public void run() {
TextureRegion[] textureRegions = new TextureRegion[pages.size]; Array<TextureRegion> textureRegions = new Array<>();
for (int i = 0; i < pages.size; i++) { for (int i = 0; i < pages.size; i++) {
PixmapPacker.Page p = pages.get(i); PixmapPacker.Page p = pages.get(i);
Texture texture = new Texture(new PixmapTextureData(p.getPixmap(), p.getPixmap().getFormat(), false, false)) { Texture texture = new Texture(new PixmapTextureData(p.getPixmap(), p.getPixmap().getFormat(), false, false)) {
@@ -211,7 +210,7 @@ public class FSkinFont {
} }
}; };
texture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest); texture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
textureRegions[i] = new TextureRegion(texture); textureRegions.addAll(new TextureRegion(texture));
} }
font = new BitmapFont(fontData, textureRegions, true); font = new BitmapFont(fontData, textureRegions, true);

View File

@@ -6,14 +6,13 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.graphics.g2d.BitmapFont.TextBounds;
import forge.Graphics; import forge.Graphics;
import forge.card.CardFaceSymbols; import forge.card.CardFaceSymbols;
import forge.model.FModel; import forge.model.FModel;
import forge.properties.ForgePreferences; import forge.properties.ForgePreferences;
import forge.properties.ForgePreferences.FPref; import forge.properties.ForgePreferences.FPref;
import forge.util.TextBounds;
//Encodes text for drawing with symbols and reminder text //Encodes text for drawing with symbols and reminder text
public class TextRenderer { public class TextRenderer {
@@ -528,10 +527,10 @@ public class TextRenderer {
return getCurrentBounds(); return getCurrentBounds();
} }
public void drawText(Graphics g, String text, FSkinFont skinFont, FSkinColor skinColor, float x, float y, float w, float h, float visibleStartY, float visibleHeight, boolean wrap0, HAlignment horzAlignment, boolean centerVertically) { public void drawText(Graphics g, String text, FSkinFont skinFont, FSkinColor skinColor, float x, float y, float w, float h, float visibleStartY, float visibleHeight, boolean wrap0, int horzAlignment, boolean centerVertically) {
drawText(g, text, skinFont, skinColor.getColor(), x, y, w, h, visibleStartY, visibleHeight, wrap0, horzAlignment, centerVertically); drawText(g, text, skinFont, skinColor.getColor(), x, y, w, h, visibleStartY, visibleHeight, wrap0, horzAlignment, centerVertically);
} }
public void drawText(Graphics g, String text, FSkinFont skinFont, Color color, float x, float y, float w, float h, float visibleStartY, float visibleHeight, boolean wrap0, HAlignment horzAlignment, boolean centerVertically) { public void drawText(Graphics g, String text, FSkinFont skinFont, Color color, float x, float y, float w, float h, float visibleStartY, float visibleHeight, boolean wrap0, int horzAlignment, boolean centerVertically) {
setProps(text, skinFont, w, h, wrap0); setProps(text, skinFont, w, h, wrap0);
if (needClip) { //prevent text flowing outside region if couldn't shrink it to fit if (needClip) { //prevent text flowing outside region if couldn't shrink it to fit
g.startClip(x, y, w, h); g.startClip(x, y, w, h);
@@ -542,13 +541,13 @@ public class TextRenderer {
float[] alignmentOffsets = new float[lineWidths.size()]; float[] alignmentOffsets = new float[lineWidths.size()];
for (int i = 0; i < lineWidths.size(); i++) { for (int i = 0; i < lineWidths.size(); i++) {
switch (horzAlignment) { switch (horzAlignment) {
case LEFT: case Align.left:
alignmentOffsets[i] = 0; alignmentOffsets[i] = 0;
break; break;
case CENTER: case Align.center:
alignmentOffsets[i] = Math.max((width - lineWidths.get(i)) / 2, 0); alignmentOffsets[i] = Math.max((width - lineWidths.get(i)) / 2, 0);
break; break;
case RIGHT: case Align.right:
alignmentOffsets[i] = Math.max(width - lineWidths.get(i), 0); alignmentOffsets[i] = Math.max(width - lineWidths.get(i), 0);
break; break;
} }
@@ -603,7 +602,7 @@ public class TextRenderer {
else if (inReminderText) { else if (inReminderText) {
color = FSkinColor.alphaColor(color, ALPHA_COMPOSITE); color = FSkinColor.alphaColor(color, ALPHA_COMPOSITE);
} }
g.drawText(text, font, color, x + offsetX, y + offsetY, w, h, false, HAlignment.LEFT, false); g.drawText(text, font, color, x + offsetX, y + offsetY, w, h, false, Align.left, false);
} }
} }

View File

@@ -2,7 +2,7 @@ package forge.card;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import forge.Graphics; import forge.Graphics;
import forge.assets.*; import forge.assets.*;
@@ -175,7 +175,7 @@ public class CardImageRenderer {
CardFaceSymbols.drawManaCost(g, otherManaCost, x + w - manaCostWidth, y + (h - MANA_SYMBOL_SIZE) / 2, MANA_SYMBOL_SIZE); CardFaceSymbols.drawManaCost(g, otherManaCost, x + w - manaCostWidth, y + (h - MANA_SYMBOL_SIZE) / 2, MANA_SYMBOL_SIZE);
//draw "//" between two parts of mana cost //draw "//" between two parts of mana cost
manaCostWidth += NAME_FONT.getBounds("//").width + HEADER_PADDING; manaCostWidth += NAME_FONT.getBounds("//").width + HEADER_PADDING;
g.drawText("//", NAME_FONT, Color.BLACK, x + w - manaCostWidth, y, w, h, false, HAlignment.LEFT, true); g.drawText("//", NAME_FONT, Color.BLACK, x + w - manaCostWidth, y, w, h, false, Align.left, true);
} }
manaCostWidth += CardFaceSymbols.getWidth(mainManaCost, MANA_SYMBOL_SIZE) + HEADER_PADDING; manaCostWidth += CardFaceSymbols.getWidth(mainManaCost, MANA_SYMBOL_SIZE) + HEADER_PADDING;
CardFaceSymbols.drawManaCost(g, mainManaCost, x + w - manaCostWidth, y + (h - MANA_SYMBOL_SIZE) / 2, MANA_SYMBOL_SIZE); CardFaceSymbols.drawManaCost(g, mainManaCost, x + w - manaCostWidth, y + (h - MANA_SYMBOL_SIZE) / 2, MANA_SYMBOL_SIZE);
@@ -183,7 +183,7 @@ public class CardImageRenderer {
//draw name for card //draw name for card
x += padding; x += padding;
w -= 2 * padding; w -= 2 * padding;
g.drawText(state.getName(), NAME_FONT, Color.BLACK, x, y, w - manaCostWidth - padding, h, false, HAlignment.LEFT, true); g.drawText(state.getName(), NAME_FONT, Color.BLACK, x, y, w - manaCostWidth - padding, h, false, Align.left, true);
} }
public static final FBufferedImage forgeArt; public static final FBufferedImage forgeArt;
@@ -221,7 +221,7 @@ public class CardImageRenderer {
//draw type //draw type
x += padding; x += padding;
g.drawText(CardDetailUtil.formatCardType(state, canShow), TYPE_FONT, Color.BLACK, x, y, w, h, false, HAlignment.LEFT, true); g.drawText(CardDetailUtil.formatCardType(state, canShow), TYPE_FONT, Color.BLACK, x, y, w, h, false, Align.left, true);
} }
//use text renderer to handle mana symbols and reminder text //use text renderer to handle mana symbols and reminder text
@@ -268,7 +268,7 @@ public class CardImageRenderer {
y += padding; y += padding;
w -= 2 * padding; w -= 2 * padding;
h -= 2 * padding; h -= 2 * padding;
cardTextRenderer.drawText(g, text, TEXT_FONT, Color.BLACK, x, y, w, h, y, h, true, HAlignment.LEFT, true); cardTextRenderer.drawText(g, text, TEXT_FONT, Color.BLACK, x, y, w, h, y, h, true, Align.left, true);
} }
} }
@@ -313,7 +313,7 @@ public class CardImageRenderer {
x += (boxWidth - totalPieceWidth) / 2; x += (boxWidth - totalPieceWidth) / 2;
for (int i = 0; i < pieces.size(); i++) { for (int i = 0; i < pieces.size(); i++) {
g.drawText(pieces.get(i), PT_FONT, Color.BLACK, x, y, w, h, false, HAlignment.LEFT, true); g.drawText(pieces.get(i), PT_FONT, Color.BLACK, x, y, w, h, false, Align.left, true);
x += pieceWidths[i]; x += pieceWidths[i];
} }
} }
@@ -451,7 +451,7 @@ public class CardImageRenderer {
CardFaceSymbols.drawManaCost(g, otherManaCost, x + w - manaCostWidth, y + (h - MANA_SYMBOL_SIZE) / 2, MANA_SYMBOL_SIZE); CardFaceSymbols.drawManaCost(g, otherManaCost, x + w - manaCostWidth, y + (h - MANA_SYMBOL_SIZE) / 2, MANA_SYMBOL_SIZE);
//draw "//" between two parts of mana cost //draw "//" between two parts of mana cost
manaCostWidth += NAME_FONT.getBounds("//").width + HEADER_PADDING; manaCostWidth += NAME_FONT.getBounds("//").width + HEADER_PADDING;
g.drawText("//", NAME_FONT, Color.BLACK, x + w - manaCostWidth, y, w, h, false, HAlignment.LEFT, true); g.drawText("//", NAME_FONT, Color.BLACK, x + w - manaCostWidth, y, w, h, false, Align.left, true);
} }
manaCostWidth += CardFaceSymbols.getWidth(mainManaCost, MANA_SYMBOL_SIZE) + HEADER_PADDING; manaCostWidth += CardFaceSymbols.getWidth(mainManaCost, MANA_SYMBOL_SIZE) + HEADER_PADDING;
CardFaceSymbols.drawManaCost(g, mainManaCost, x + w - manaCostWidth, y + (h - MANA_SYMBOL_SIZE) / 2, MANA_SYMBOL_SIZE); CardFaceSymbols.drawManaCost(g, mainManaCost, x + w - manaCostWidth, y + (h - MANA_SYMBOL_SIZE) / 2, MANA_SYMBOL_SIZE);
@@ -460,7 +460,7 @@ public class CardImageRenderer {
//draw name for card //draw name for card
x += padding; x += padding;
w -= 2 * padding; w -= 2 * padding;
g.drawText(CardDetailUtil.formatCardName(card, canShow, state == card.getAlternateState()), NAME_FONT, Color.BLACK, x, y, w - manaCostWidth - padding, h, false, HAlignment.LEFT, true); g.drawText(CardDetailUtil.formatCardName(card, canShow, state == card.getAlternateState()), NAME_FONT, Color.BLACK, x, y, w - manaCostWidth - padding, h, false, Align.left, true);
//draw type and set label for card //draw type and set label for card
y += h; y += h;
@@ -478,7 +478,7 @@ public class CardImageRenderer {
w -= setWidth; //reduce available width for type w -= setWidth; //reduce available width for type
} }
g.drawText(CardDetailUtil.formatCardType(state, canShow), TYPE_FONT, Color.BLACK, x, y, w, h, false, HAlignment.LEFT, true); g.drawText(CardDetailUtil.formatCardType(state, canShow), TYPE_FONT, Color.BLACK, x, y, w, h, false, Align.left, true);
} }
private static void drawDetailsTextBox(Graphics g, CardStateView state, GameView gameView, boolean canShow, Color[] colors, float x, float y, float w, float h) { private static void drawDetailsTextBox(Graphics g, CardStateView state, GameView gameView, boolean canShow, Color[] colors, float x, float y, float w, float h) {
@@ -491,14 +491,14 @@ public class CardImageRenderer {
y += padY; y += padY;
w -= 2 * padX; w -= 2 * padX;
h -= 2 * padY; h -= 2 * padY;
cardTextRenderer.drawText(g, CardDetailUtil.composeCardText(state, gameView, canShow), TEXT_FONT, Color.BLACK, x, y, w, h, y, h, true, HAlignment.LEFT, false); cardTextRenderer.drawText(g, CardDetailUtil.composeCardText(state, gameView, canShow), TEXT_FONT, Color.BLACK, x, y, w, h, y, h, true, Align.left, false);
} }
private static void drawDetailsIdAndPtBox(Graphics g, CardView card, CardStateView state, boolean canShow, Color idForeColor, Color[] colors, float x, float y, float w, float h) { private static void drawDetailsIdAndPtBox(Graphics g, CardView card, CardStateView state, boolean canShow, Color idForeColor, Color[] colors, float x, float y, float w, float h) {
float idWidth = 0; float idWidth = 0;
if (canShow) { if (canShow) {
String idText = CardDetailUtil.formatCardId(state); String idText = CardDetailUtil.formatCardId(state);
g.drawText(idText, TYPE_FONT, idForeColor, x, y + TYPE_FONT.getCapHeight() / 2, w, h, false, HAlignment.LEFT, false); g.drawText(idText, TYPE_FONT, idForeColor, x, y + TYPE_FONT.getCapHeight() / 2, w, h, false, Align.left, false);
idWidth = TYPE_FONT.getBounds(idText).width; idWidth = TYPE_FONT.getBounds(idText).width;
} }
@@ -513,6 +513,6 @@ public class CardImageRenderer {
fillColorBackground(g, colors, x, y, w, h); fillColorBackground(g, colors, x, y, w, h);
g.drawRect(BORDER_THICKNESS, Color.BLACK, x, y, w, h); g.drawRect(BORDER_THICKNESS, Color.BLACK, x, y, w, h);
g.drawText(ptText, PT_FONT, Color.BLACK, x, y, w, h, false, HAlignment.CENTER, true); g.drawText(ptText, PT_FONT, Color.BLACK, x, y, w, h, false, Align.center, true);
} }
} }

View File

@@ -1,6 +1,6 @@
package forge.card; package forge.card;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
import forge.item.PaperCard; import forge.item.PaperCard;
@@ -14,7 +14,7 @@ public class CardListPreview extends FLabel {
public CardListPreview(FChoiceList<PaperCard> list0) { public CardListPreview(FChoiceList<PaperCard> list0) {
super(new FLabel.Builder().iconScaleFactor(1).insets(new Vector2(0, 0)) super(new FLabel.Builder().iconScaleFactor(1).insets(new Vector2(0, 0))
.iconInBackground(true).align(HAlignment.CENTER)); .iconInBackground(true).align(Align.center));
list = list0; list = list0;
} }

View File

@@ -7,13 +7,13 @@ import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Pixmap; import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.graphics.g2d.GlyphLayout;
import com.badlogic.gdx.graphics.g2d.BitmapFont.TextBounds;
import com.badlogic.gdx.graphics.g2d.PixmapPacker; import com.badlogic.gdx.graphics.g2d.PixmapPacker;
import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator; import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter; import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter;
import com.badlogic.gdx.graphics.glutils.PixmapTextureData; import com.badlogic.gdx.graphics.glutils.PixmapTextureData;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Array;
import forge.CachedCardImage; import forge.CachedCardImage;
import forge.FThreads; import forge.FThreads;
@@ -40,7 +40,7 @@ import forge.screens.match.MatchController;
import forge.toolbox.FList; import forge.toolbox.FList;
import forge.util.Utils; import forge.util.Utils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import forge.util.TextBounds;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -95,6 +95,7 @@ public class CardRenderer {
private static Map<Integer, BitmapFont> counterFonts = new HashMap<>(); private static Map<Integer, BitmapFont> counterFonts = new HashMap<>();
private static final Color counterBackgroundColor = new Color(0f, 0f, 0f, 0.9f); private static final Color counterBackgroundColor = new Color(0f, 0f, 0f, 0.9f);
private static final Map<CounterType, Color> counterColorCache = new HashMap<>(); private static final Map<CounterType, Color> counterColorCache = new HashMap<>();
private static final GlyphLayout layout = new GlyphLayout();
static { static {
try { try {
@@ -261,7 +262,7 @@ public class CardRenderer {
if (suffix != null) { if (suffix != null) {
name += suffix; name += suffix;
} }
g.drawText(name, font, foreColor, x, y, w, h, false, HAlignment.CENTER, true); g.drawText(name, font, foreColor, x, y, w, h, false, Align.center, true);
} }
} }
@@ -310,7 +311,7 @@ public class CardRenderer {
CardFaceSymbols.drawManaCost(g, otherManaCost, x + w - manaCostWidth + MANA_COST_PADDING, y, MANA_SYMBOL_SIZE); CardFaceSymbols.drawManaCost(g, otherManaCost, x + w - manaCostWidth + MANA_COST_PADDING, y, MANA_SYMBOL_SIZE);
//draw "//" between two parts of mana cost //draw "//" between two parts of mana cost
manaCostWidth += font.getBounds("//").width + MANA_COST_PADDING; manaCostWidth += font.getBounds("//").width + MANA_COST_PADDING;
g.drawText("//", font, foreColor, x + w - manaCostWidth + MANA_COST_PADDING, y, w, MANA_SYMBOL_SIZE, false, HAlignment.LEFT, true); g.drawText("//", font, foreColor, x + w - manaCostWidth + MANA_COST_PADDING, y, w, MANA_SYMBOL_SIZE, false, Align.left, true);
} }
manaCostWidth += CardFaceSymbols.getWidth(mainManaCost, MANA_SYMBOL_SIZE); manaCostWidth += CardFaceSymbols.getWidth(mainManaCost, MANA_SYMBOL_SIZE);
CardFaceSymbols.drawManaCost(g, mainManaCost, x + w - manaCostWidth, y, MANA_SYMBOL_SIZE); CardFaceSymbols.drawManaCost(g, mainManaCost, x + w - manaCostWidth, y, MANA_SYMBOL_SIZE);
@@ -323,7 +324,7 @@ public class CardRenderer {
if (suffix != null) { if (suffix != null) {
name += suffix; name += suffix;
} }
g.drawText(name, font, foreColor, x, y, w - manaCostWidth - cardArtWidth - FList.PADDING, MANA_SYMBOL_SIZE, false, HAlignment.LEFT, true); g.drawText(name, font, foreColor, x, y, w - manaCostWidth - cardArtWidth - FList.PADDING, MANA_SYMBOL_SIZE, false, Align.left, true);
if (compactMode) { if (compactMode) {
return; //skip second line if rendering in compact mode return; //skip second line if rendering in compact mode
@@ -350,7 +351,7 @@ public class CardRenderer {
else if (card.getCurrentState().getType().hasSubtype("Vehicle")) { else if (card.getCurrentState().getType().hasSubtype("Vehicle")) {
type += String.format(" [%s / %s]", power, toughness); type += String.format(" [%s / %s]", power, toughness);
} }
g.drawText(type, typeFont, foreColor, x, y, availableTypeWidth, lineHeight, false, HAlignment.LEFT, true); g.drawText(type, typeFont, foreColor, x, y, availableTypeWidth, lineHeight, false, Align.left, true);
} }
public static boolean cardListItemTap(List<?> cards, int selectedIndex, ActivateHandler activateHandler, float x, float y, int count, boolean compactMode) { public static boolean cardListItemTap(List<?> cards, int selectedIndex, ActivateHandler activateHandler, float x, float y, int count, boolean compactMode) {
@@ -379,7 +380,7 @@ public class CardRenderer {
Color backColor = getRarityColor(rarity); Color backColor = getRarityColor(rarity);
Color foreColor = FSkinColor.getHighContrastColor(backColor); Color foreColor = FSkinColor.getHighContrastColor(backColor);
g.fillRect(backColor, x, y, w, h); g.fillRect(backColor, x, y, w, h);
g.drawText(set, font, foreColor, x, y, w, h, false, HAlignment.CENTER, true); g.drawText(set, font, foreColor, x, y, w, h, false, Align.center, true);
} }
public static void drawCard(Graphics g, IPaperCard pc, float x, float y, float w, float h, CardStackPosition pos) { public static void drawCard(Graphics g, IPaperCard pc, float x, float y, float w, float h, CardStackPosition pos) {
@@ -447,7 +448,7 @@ public class CardRenderer {
//draw name and mana cost overlays if card is small or default card image being used //draw name and mana cost overlays if card is small or default card image being used
if (h <= NAME_COST_THRESHOLD && canShow) { if (h <= NAME_COST_THRESHOLD && canShow) {
if (showCardNameOverlay(card)) { if (showCardNameOverlay(card)) {
g.drawOutlinedText(details.getName(), FSkinFont.forHeight(h * 0.18f), Color.WHITE, Color.BLACK, x + padding, y + padding, w - 2 * padding, h * 0.4f, true, HAlignment.LEFT, false); g.drawOutlinedText(details.getName(), FSkinFont.forHeight(h * 0.18f), Color.WHITE, Color.BLACK, x + padding, y + padding, w - 2 * padding, h * 0.4f, true, Align.left, false);
} }
if (showCardManaCostOverlay(card)) { if (showCardManaCostOverlay(card)) {
float manaSymbolSize = w / 4; float manaSymbolSize = w / 4;
@@ -476,7 +477,7 @@ public class CardRenderer {
if (canShow && showCardIdOverlay(card)) { if (canShow && showCardIdOverlay(card)) {
FSkinFont idFont = FSkinFont.forHeight(h * 0.12f); FSkinFont idFont = FSkinFont.forHeight(h * 0.12f);
float idHeight = idFont.getCapHeight(); float idHeight = idFont.getCapHeight();
g.drawOutlinedText(String.valueOf(card.getId()), idFont, Color.WHITE, Color.BLACK, x + padding, y + h - idHeight - padding, w, h, false, HAlignment.LEFT, false); g.drawOutlinedText(String.valueOf(card.getId()), idFont, Color.WHITE, Color.BLACK, x + padding, y + h - idHeight - padding, w, h, false, Align.left, false);
} }
if (card.getCounters() != null && !card.getCounters().isEmpty()) { if (card.getCounters() != null && !card.getCounters().isEmpty()) {
@@ -556,7 +557,11 @@ public class CardRenderer {
maxCounters = Math.max(maxCounters, numberOfCounters); maxCounters = Math.max(maxCounters, numberOfCounters);
} }
if (counterBoxBaseWidth + font.getBounds(String.valueOf(maxCounters)).width > w) { //if (counterBoxBaseWidth + font.getBounds(String.valueOf(maxCounters)).width > w) {
layout.setText(font, String.valueOf(maxCounters));
if (counterBoxBaseWidth + layout.width > w) {
drawCounterImage(card, g, x, y, w, h); drawCounterImage(card, g, x, y, w, h);
return; return;
} }
@@ -567,7 +572,9 @@ public class CardRenderer {
final CounterType counter = counterEntry.getKey(); final CounterType counter = counterEntry.getKey();
final int numberOfCounters = counterEntry.getValue(); final int numberOfCounters = counterEntry.getValue();
final float counterBoxRealWidth = counterBoxBaseWidth + font.getBounds(String.valueOf(numberOfCounters)).width + 4; //final float counterBoxRealWidth = counterBoxBaseWidth + font.getBounds(String.valueOf(numberOfCounters)).width + 4;
layout.setText(font, String.valueOf(numberOfCounters));
final float counterBoxRealWidth = counterBoxBaseWidth + layout.width + 4;
final float counterYOffset = spaceFromTopOfCard - (currentCounter++ * (counterBoxHeight + counterBoxSpacing)); final float counterYOffset = spaceFromTopOfCard - (currentCounter++ * (counterBoxHeight + counterBoxSpacing));
@@ -579,8 +586,8 @@ public class CardRenderer {
Color counterColor = counterColorCache.get(counter); Color counterColor = counterColorCache.get(counter);
drawText(g, counter.getCounterOnCardDisplayName(), font, counterColor, x + 2 + additionalXOffset, counterYOffset, counterBoxRealWidth, counterBoxHeight, HAlignment.LEFT); drawText(g, counter.getCounterOnCardDisplayName(), font, counterColor, x + 2 + additionalXOffset, counterYOffset, counterBoxRealWidth, counterBoxHeight, Align.left);
drawText(g, String.valueOf(numberOfCounters), font, counterColor, x + counterBoxBaseWidth - 4f - additionalXOffset, counterYOffset, counterBoxRealWidth, counterBoxHeight, HAlignment.LEFT); drawText(g, String.valueOf(numberOfCounters), font, counterColor, x + counterBoxBaseWidth - 4f - additionalXOffset, counterYOffset, counterBoxRealWidth, counterBoxHeight, Align.left);
} }
@@ -588,13 +595,14 @@ public class CardRenderer {
private static final int GL_BLEND = GL20.GL_BLEND; private static final int GL_BLEND = GL20.GL_BLEND;
private static void drawText(Graphics g, String text, BitmapFont font, Color color, float x, float y, float w, float h, HAlignment horizontalAlignment) { private static void drawText(Graphics g, String text, BitmapFont font, Color color, float x, float y, float w, float h, int horizontalAlignment) {
if (color.a < 1) { //enable blending so alpha colored shapes work properly if (color.a < 1) { //enable blending so alpha colored shapes work properly
Gdx.gl.glEnable(GL_BLEND); Gdx.gl.glEnable(GL_BLEND);
} }
TextBounds textBounds = font.getMultiLineBounds(text); layout.setText(font, text);
TextBounds textBounds = new TextBounds(layout.width, layout.height);
float textHeight = textBounds.height; float textHeight = textBounds.height;
if (h > textHeight) { if (h > textHeight) {
@@ -602,7 +610,7 @@ public class CardRenderer {
} }
font.setColor(color); font.setColor(color);
font.drawMultiLine(g.getBatch(), text, g.adjustX(x), g.adjustY(y, 0), w, horizontalAlignment); font.draw(g.getBatch(), text, g.adjustX(x), g.adjustY(y, 0), w, horizontalAlignment, true);
if (color.a < 1) { if (color.a < 1) {
Gdx.gl.glDisable(GL_BLEND); Gdx.gl.glDisable(GL_BLEND);
@@ -685,7 +693,7 @@ public class CardRenderer {
//draw card damage above P/T box if needed //draw card damage above P/T box if needed
if (card.getDamage() > 0) { if (card.getDamage() > 0) {
g.drawOutlinedText(">" + card.getDamage() + "<", font, Color.RED, Color.WHITE, x, y - h + padding, w, h, false, HAlignment.CENTER, true); g.drawOutlinedText(">" + card.getDamage() + "<", font, Color.RED, Color.WHITE, x, y - h + padding, w, h, false, Align.center, true);
} }
g.fillRect(color, x, y, w, h); g.fillRect(color, x, y, w, h);
@@ -693,7 +701,7 @@ public class CardRenderer {
x += padding; x += padding;
for (int i = 0; i < pieces.size(); i++) { for (int i = 0; i < pieces.size(); i++) {
g.drawText(pieces.get(i), font, Color.BLACK, x, y, w, h, false, HAlignment.LEFT, true); g.drawText(pieces.get(i), font, Color.BLACK, x, y, w, h, false, Align.left, true);
x += pieceWidths.get(i); x += pieceWidths.get(i);
} }
} }
@@ -771,7 +779,8 @@ public class CardRenderer {
@Override @Override
public void run() { public void run() {
TextureRegion[] textureRegions = new TextureRegion[pages.size]; //TextureRegion[] textureRegions = new TextureRegion[pages.size];
Array<TextureRegion> textureRegions = new Array<>();
for (int i = 0; i < pages.size; i++) { for (int i = 0; i < pages.size; i++) {
PixmapPacker.Page p = pages.get(i); PixmapPacker.Page p = pages.get(i);
Texture texture = new Texture(new PixmapTextureData(p.getPixmap(), p.getPixmap().getFormat(), false, false)) { Texture texture = new Texture(new PixmapTextureData(p.getPixmap(), p.getPixmap().getFormat(), false, false)) {
@@ -782,7 +791,8 @@ public class CardRenderer {
} }
}; };
texture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest); texture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
textureRegions[i] = new TextureRegion(texture); //textureRegions[i] = new TextureRegion(texture);
textureRegions.add(new TextureRegion(texture));
} }
counterFonts.put(fontSize, new BitmapFont(fontData, textureRegions, true)); counterFonts.put(fontSize, new BitmapFont(fontData, textureRegions, true));

View File

@@ -5,8 +5,8 @@ import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.utils.Align;
import forge.Forge; import forge.Forge;
import forge.Graphics; import forge.Graphics;
@@ -281,10 +281,10 @@ public class CardZoom extends FOverlay {
if (currentActivateAction != null) { if (currentActivateAction != null) {
g.fillRect(FDialog.MSG_BACK_COLOR, 0, 0, w, messageHeight); g.fillRect(FDialog.MSG_BACK_COLOR, 0, 0, w, messageHeight);
g.drawText("Swipe up to " + currentActivateAction, FDialog.MSG_FONT, FDialog.MSG_FORE_COLOR, 0, 0, w, messageHeight, false, HAlignment.CENTER, true); g.drawText("Swipe up to " + currentActivateAction, FDialog.MSG_FONT, FDialog.MSG_FORE_COLOR, 0, 0, w, messageHeight, false, Align.center, true);
} }
g.fillRect(FDialog.MSG_BACK_COLOR, 0, h - messageHeight, w, messageHeight); g.fillRect(FDialog.MSG_BACK_COLOR, 0, h - messageHeight, w, messageHeight);
g.drawText("Swipe down to switch to " + (zoomMode ? "detail" : "picture") + " view", FDialog.MSG_FONT, FDialog.MSG_FORE_COLOR, 0, h - messageHeight, w, messageHeight, false, HAlignment.CENTER, true); g.drawText("Swipe down to switch to " + (zoomMode ? "detail" : "picture") + " view", FDialog.MSG_FONT, FDialog.MSG_FORE_COLOR, 0, h - messageHeight, w, messageHeight, false, Align.center, true);
} }
@Override @Override

View File

@@ -48,7 +48,7 @@ import forge.toolbox.FTextArea;
import forge.util.Callback; import forge.util.Callback;
import forge.util.Utils; import forge.util.Utils;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import java.util.Map; import java.util.Map;
@@ -122,7 +122,7 @@ public class AddBasicLandsDialog extends FDialog {
callback = callback0; callback = callback0;
currentDeck = deck; currentDeck = deck;
lblDeckInfo.setAlignment(HAlignment.CENTER); lblDeckInfo.setAlignment(Align.center);
lblDeckInfo.setFont(FSkinFont.get(12)); lblDeckInfo.setFont(FSkinFont.get(12));
cbLandSet.setFont(lblLandSet.getFont()); cbLandSet.setFont(lblLandSet.getFont());
@@ -322,7 +322,7 @@ public class AddBasicLandsDialog extends FDialog {
card = generateCard(artIndex); //generate card for display card = generateCard(artIndex); //generate card for display
} }
}); });
lblCount = add(new FLabel.Builder().text("0").font(FSkinFont.get(18)).align(HAlignment.CENTER).build()); lblCount = add(new FLabel.Builder().text("0").font(FSkinFont.get(18)).align(Align.center).build());
btnSubtract = add(new FLabel.ButtonBuilder().icon(FSkinImage.MINUS).command(new FEventHandler() { btnSubtract = add(new FLabel.ButtonBuilder().icon(FSkinImage.MINUS).command(new FEventHandler() {
@Override @Override
public void handleEvent(FEvent e) { public void handleEvent(FEvent e) {

View File

@@ -41,7 +41,7 @@ import forge.util.storage.IStorage;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import java.util.ArrayList; import java.util.ArrayList;
@@ -524,7 +524,7 @@ public class FDeckChooser extends FScreen {
cmbDeckTypes.addItem(DeckType.RANDOM_DECK); cmbDeckTypes.addItem(DeckType.RANDOM_DECK);
break; break;
} }
cmbDeckTypes.setAlignment(HAlignment.CENTER); cmbDeckTypes.setAlignment(Align.center);
restoreSavedState(); restoreSavedState();
cmbDeckTypes.setChangedHandler(new FEventHandler() { cmbDeckTypes.setChangedHandler(new FEventHandler() {
@Override @Override

View File

@@ -1,8 +1,8 @@
package forge.deck; package forge.deck;
import com.badlogic.gdx.Input.Keys; import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Align;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
import com.google.common.base.Supplier; import com.google.common.base.Supplier;
@@ -239,8 +239,8 @@ public class FDeckEditor extends TabPageScreen<FDeckEditor> {
protected final DeckHeader deckHeader = add(new DeckHeader()); protected final DeckHeader deckHeader = add(new DeckHeader());
protected final FLabel lblName = deckHeader.add(new FLabel.Builder().font(FSkinFont.get(16)).insets(new Vector2(Utils.scale(5), 0)).build()); protected final FLabel lblName = deckHeader.add(new FLabel.Builder().font(FSkinFont.get(16)).insets(new Vector2(Utils.scale(5), 0)).build());
private final FLabel btnSave = deckHeader.add(new FLabel.Builder().icon(FSkinImage.SAVE).align(HAlignment.CENTER).pressedColor(Header.BTN_PRESSED_COLOR).build()); private final FLabel btnSave = deckHeader.add(new FLabel.Builder().icon(FSkinImage.SAVE).align(Align.center).pressedColor(Header.BTN_PRESSED_COLOR).build());
private final FLabel btnMoreOptions = deckHeader.add(new FLabel.Builder().text("...").font(FSkinFont.get(20)).align(HAlignment.CENTER).pressedColor(Header.BTN_PRESSED_COLOR).build()); private final FLabel btnMoreOptions = deckHeader.add(new FLabel.Builder().text("...").font(FSkinFont.get(20)).align(Align.center).pressedColor(Header.BTN_PRESSED_COLOR).build());
public FDeckEditor(EditorType editorType0, DeckProxy editDeck, boolean showMainDeck) { public FDeckEditor(EditorType editorType0, DeckProxy editDeck, boolean showMainDeck) {
this(editorType0, editDeck.getName(), editDeck.getPath(), null, showMainDeck); this(editorType0, editDeck.getName(), editDeck.getPath(), null, showMainDeck);

View File

@@ -1,8 +1,6 @@
package forge.error; package forge.error;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.graphics.g2d.BitmapFont.TextBounds;
import forge.Forge; import forge.Forge;
import forge.Graphics; import forge.Graphics;
import forge.assets.FSkinColor; import forge.assets.FSkinColor;
@@ -15,6 +13,7 @@ import forge.toolbox.FEvent.FEventHandler;
import forge.toolbox.FScrollPane; import forge.toolbox.FScrollPane;
import forge.toolbox.FTextArea; import forge.toolbox.FTextArea;
import forge.util.Callback; import forge.util.Callback;
import forge.util.TextBounds;
import forge.util.Utils; import forge.util.Utils;
public class BugReportDialog extends FScreen { //use screen rather than dialog so screen with bug isn't rendered public class BugReportDialog extends FScreen { //use screen rather than dialog so screen with bug isn't rendered
@@ -148,7 +147,7 @@ public class BugReportDialog extends FScreen { //use screen rather than dialog s
@Override @Override
public void drawBackground(Graphics g) { public void drawBackground(Graphics g) {
g.fillRect(BACK_COLOR, 0, 0, getWidth(), getHeight()); g.fillRect(BACK_COLOR, 0, 0, getWidth(), getHeight());
g.drawText(text, FONT, FORE_COLOR, PADDING - getScrollLeft(), PADDING - getScrollTop(), getScrollWidth() - 2 * PADDING, getScrollHeight() - 2 * PADDING, false, HAlignment.LEFT, false); g.drawText(text, FONT, FORE_COLOR, PADDING - getScrollLeft(), PADDING - getScrollTop(), getScrollWidth() - 2 * PADDING, getScrollHeight() - 2 * PADDING, false, Align.left, false);
} }
@Override @Override

View File

@@ -20,7 +20,7 @@ import forge.toolbox.FList;
import forge.toolbox.FList.CompactModeHandler; import forge.toolbox.FList.CompactModeHandler;
import forge.util.Utils; import forge.util.Utils;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import java.util.Map.Entry; import java.util.Map.Entry;
@@ -118,7 +118,7 @@ public final class DeckManager extends ItemManager<DeckProxy> implements IHasGam
if (DeckManager.this.getConfig().getCols().size() == 1) { if (DeckManager.this.getConfig().getCols().size() == 1) {
//if just string column, just draw deck string value //if just string column, just draw deck string value
g.drawText(deck.toString(), font, foreColor, x, y, w, h, false, HAlignment.LEFT, true); g.drawText(deck.toString(), font, foreColor, x, y, w, h, false, Align.left, true);
return; return;
} }
@@ -131,7 +131,7 @@ public final class DeckManager extends ItemManager<DeckProxy> implements IHasGam
if (!deck.getPath().isEmpty()) { //render path after name if needed if (!deck.getPath().isEmpty()) { //render path after name if needed
name += " (" + deck.getPath().substring(1) + ")"; name += " (" + deck.getPath().substring(1) + ")";
} }
g.drawText(name, font, foreColor, x, y, availableNameWidth, IMAGE_SIZE, false, HAlignment.LEFT, true); g.drawText(name, font, foreColor, x, y, availableNameWidth, IMAGE_SIZE, false, Align.left, true);
x += availableNameWidth + FList.PADDING; x += availableNameWidth + FList.PADDING;
CardFaceSymbols.drawColorSet(g, deckColor, x, y, IMAGE_SIZE); CardFaceSymbols.drawColorSet(g, deckColor, x, y, IMAGE_SIZE);
@@ -158,7 +158,7 @@ public final class DeckManager extends ItemManager<DeckProxy> implements IHasGam
sideSize = 0; //show sideboard as 0 if empty sideSize = 0; //show sideboard as 0 if empty
} }
g.drawText(deck.getFormatsString() + " (" + mainSize + " / " + sideSize + ")", font, foreColor, x, y, availableFormatWidth, lineHeight, false, HAlignment.LEFT, true); g.drawText(deck.getFormatsString() + " (" + mainSize + " / " + sideSize + ")", font, foreColor, x, y, availableFormatWidth, lineHeight, false, Align.left, true);
x += availableFormatWidth + CardRenderer.SET_BOX_MARGIN; x += availableFormatWidth + CardRenderer.SET_BOX_MARGIN;
y -= CardRenderer.SET_BOX_MARGIN; y -= CardRenderer.SET_BOX_MARGIN;

View File

@@ -18,8 +18,8 @@
package forge.itemmanager; package forge.itemmanager;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.utils.Align;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
@@ -83,7 +83,7 @@ public abstract class ItemManager<T extends InventoryItem> extends FContainer im
private final FLabel btnView = new FLabel.ButtonBuilder() private final FLabel btnView = new FLabel.ButtonBuilder()
.iconScaleFactor(0.9f).build(); //icon set later .iconScaleFactor(0.9f).build(); //icon set later
private final FLabel btnAdvancedSearchOptions = new FLabel.Builder() private final FLabel btnAdvancedSearchOptions = new FLabel.Builder()
.selectable(true).align(HAlignment.CENTER) .selectable(true).align(Align.center)
.icon(FSkinImage.SETTINGS).iconScaleFactor(0.9f) .icon(FSkinImage.SETTINGS).iconScaleFactor(0.9f)
.build(); .build();

View File

@@ -3,7 +3,7 @@ package forge.itemmanager;
import java.util.Map.Entry; import java.util.Map.Entry;
import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import com.google.common.base.Function; import com.google.common.base.Function;
import forge.Graphics; import forge.Graphics;
@@ -67,7 +67,7 @@ public class SpellShopManager extends ItemManager<InventoryItem> {
CardRenderer.drawCardListItem(g, font, foreColor, (PaperCard)value.getKey(), value.getValue(), getItemSuffix(value), x, y, w, h, compactModeHandler.isCompactMode()); CardRenderer.drawCardListItem(g, font, foreColor, (PaperCard)value.getKey(), value.getValue(), getItemSuffix(value), x, y, w, h, compactModeHandler.isCompactMode());
} }
else { else {
g.drawText(value.getValue().toString() + " " + value.getKey().toString(), font, foreColor, x + cardArtWidth, y, w - cardArtWidth, h, false, HAlignment.LEFT, true); g.drawText(value.getValue().toString() + " " + value.getKey().toString(), font, foreColor, x + cardArtWidth, y, w - cardArtWidth, h, false, Align.left, true);
Texture image = ImageCache.getImage(value.getKey()); Texture image = ImageCache.getImage(value.getKey());
if (image != null) { if (image != null) {
float imageRatio = (float)image.getWidth() / (float)image.getHeight(); float imageRatio = (float)image.getWidth() / (float)image.getHeight();
@@ -87,7 +87,7 @@ public class SpellShopManager extends ItemManager<InventoryItem> {
g.fillRect(backColor, x - FList.PADDING, y, cardArtWidth, priceHeight); g.fillRect(backColor, x - FList.PADDING, y, cardArtWidth, priceHeight);
g.drawImage(FSkinImage.QUEST_COINSTACK, x, y, priceHeight, priceHeight); g.drawImage(FSkinImage.QUEST_COINSTACK, x, y, priceHeight, priceHeight);
float offset = priceHeight * 1.1f; float offset = priceHeight * 1.1f;
g.drawText(fnGetPrice.apply(value).toString(), font, foreColor, x + offset, y, cardArtWidth - offset - 2 * FList.PADDING, priceHeight, false, HAlignment.LEFT, true); g.drawText(fnGetPrice.apply(value).toString(), font, foreColor, x + offset, y, cardArtWidth - offset - 2 * FList.PADDING, priceHeight, false, Align.left, true);
} }
@Override @Override

View File

@@ -1,6 +1,6 @@
package forge.itemmanager.filters; package forge.itemmanager.filters;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
@@ -97,7 +97,7 @@ public class AdvancedSearchFilter<T extends InventoryItem> extends ItemFilter<T>
private String toolTipText; private String toolTipText;
private FiltersLabel() { private FiltersLabel() {
super(new FLabel.Builder().align(HAlignment.LEFT).parseSymbols(true).font(ListLabelFilter.LABEL_FONT)); super(new FLabel.Builder().align(Align.left).parseSymbols(true).font(ListLabelFilter.LABEL_FONT));
} }
@Override @Override
@@ -231,12 +231,12 @@ public class AdvancedSearchFilter<T extends InventoryItem> extends ItemFilter<T>
private AdvancedSearch.Filter<T> filter; private AdvancedSearch.Filter<T> filter;
private Filter() { private Filter() {
btnNotBeforeParen = add(new FLabel.Builder().align(HAlignment.CENTER).text("NOT").selectable().build()); btnNotBeforeParen = add(new FLabel.Builder().align(Align.center).text("NOT").selectable().build());
btnOpenParen = add(new FLabel.Builder().align(HAlignment.CENTER).text("(").selectable().build()); btnOpenParen = add(new FLabel.Builder().align(Align.center).text("(").selectable().build());
btnNotAfterParen = add(new FLabel.Builder().align(HAlignment.CENTER).text("NOT").selectable().build()); btnNotAfterParen = add(new FLabel.Builder().align(Align.center).text("NOT").selectable().build());
btnFilter = add(new FLabel.ButtonBuilder().parseSymbols(true).build()); btnFilter = add(new FLabel.ButtonBuilder().parseSymbols(true).build());
btnCloseParen = add(new FLabel.Builder().align(HAlignment.CENTER).selectable().text(")").build()); btnCloseParen = add(new FLabel.Builder().align(Align.center).selectable().text(")").build());
btnAnd = add(new FLabel.Builder().align(HAlignment.CENTER).text("AND").selectable().command(new FEventHandler() { btnAnd = add(new FLabel.Builder().align(Align.center).text("AND").selectable().command(new FEventHandler() {
@Override @Override
public void handleEvent(FEvent e) { public void handleEvent(FEvent e) {
if (btnAnd.isSelected()) { if (btnAnd.isSelected()) {
@@ -248,7 +248,7 @@ public class AdvancedSearchFilter<T extends InventoryItem> extends ItemFilter<T>
} }
} }
}).build()); }).build());
btnOr = add(new FLabel.Builder().align(HAlignment.CENTER).text("OR").selectable().command(new FEventHandler() { btnOr = add(new FLabel.Builder().align(Align.center).text("OR").selectable().command(new FEventHandler() {
@Override @Override
public void handleEvent(FEvent e) { public void handleEvent(FEvent e) {
if (btnOr.isSelected()) { if (btnOr.isSelected()) {

View File

@@ -24,7 +24,7 @@ import forge.util.Utils;
import java.util.*; import java.util.*;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
public abstract class FormatFilter<T extends InventoryItem> extends ItemFilter<T> { public abstract class FormatFilter<T extends InventoryItem> extends ItemFilter<T> {
@@ -231,7 +231,7 @@ public abstract class FormatFilter<T extends InventoryItem> extends ItemFilter<T
float textHeight = h; float textHeight = h;
h *= 0.66f; h *= 0.66f;
g.drawText(value.toString(), font, foreColor, x, y, w - h - FList.PADDING, textHeight, false, HAlignment.LEFT, true); g.drawText(value.toString(), font, foreColor, x, y, w - h - FList.PADDING, textHeight, false, Align.left, true);
x += w - h; x += w - h;
y += (textHeight - h) / 2; y += (textHeight - h) / 2;

View File

@@ -1,6 +1,6 @@
package forge.itemmanager.filters; package forge.itemmanager.filters;
import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.utils.Align;
import forge.Forge; import forge.Forge;
import forge.Graphics; import forge.Graphics;
import forge.assets.FSkinColor; import forge.assets.FSkinColor;
@@ -132,7 +132,7 @@ public class HistoricFormatSelect extends FScreen {
float textHeight = h; float textHeight = h;
h *= 0.66f; h *= 0.66f;
g.drawText(value.toString(), font, foreColor, x, y, w - h - FList.PADDING, textHeight, false, BitmapFont.HAlignment.LEFT, true); g.drawText(value.toString(), font, foreColor, x, y, w - h - FList.PADDING, textHeight, false, Align.left, true);
x += w - h; x += w - h;
y += (textHeight - h) / 2; y += (textHeight - h) / 2;

View File

@@ -1,7 +1,6 @@
package forge.itemmanager.filters; package forge.itemmanager.filters;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import forge.assets.FSkinFont; import forge.assets.FSkinFont;
import forge.item.InventoryItem; import forge.item.InventoryItem;
import forge.itemmanager.ItemManager; import forge.itemmanager.ItemManager;
@@ -60,7 +59,7 @@ public abstract class ListLabelFilter<T extends InventoryItem> extends ItemFilte
private class ListLabel extends FLabel { private class ListLabel extends FLabel {
private ListLabel() { private ListLabel() {
super(new FLabel.Builder().align(HAlignment.LEFT).font(LABEL_FONT)); super(new FLabel.Builder().align(Align.left).font(LABEL_FONT));
} }
@Override @Override

View File

@@ -1,6 +1,6 @@
package forge.itemmanager.filters; package forge.itemmanager.filters;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
@@ -101,7 +101,7 @@ public class TextSearchFilter<T extends InventoryItem> extends ItemFilter<T> {
@Override @Override
public void draw(Graphics g) { public void draw(Graphics g) {
super.draw(g); super.draw(g);
g.drawText(ratio, renderedFont, GHOST_TEXT_COLOR, 0, 0, getWidth() - PADDING, getHeight(), false, HAlignment.RIGHT, true); g.drawText(ratio, renderedFont, GHOST_TEXT_COLOR, 0, 0, getWidth() - PADDING, getHeight(), false, Align.right, true);
} }
} }
} }

View File

@@ -3,7 +3,7 @@ package forge.itemmanager.filters;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import forge.assets.FImage; import forge.assets.FImage;
import forge.item.InventoryItem; import forge.item.InventoryItem;
@@ -70,7 +70,7 @@ public abstract class ToggleButtonsFilter<T extends InventoryItem> extends ItemF
private ToggleButton(FImage icon) { private ToggleButton(FImage icon) {
super(new FLabel.Builder() super(new FLabel.Builder()
.icon(icon).iconScaleFactor(1f) .icon(icon).iconScaleFactor(1f)
.align(HAlignment.CENTER) .align(Align.center)
.selectable(true).selected(true) .selectable(true).selected(true)
.command(new FEventHandler() { .command(new FEventHandler() {
@Override @Override

View File

@@ -1,6 +1,6 @@
package forge.itemmanager.filters; package forge.itemmanager.filters;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import forge.card.CardRules; import forge.card.CardRules;
@@ -55,7 +55,7 @@ public abstract class ValueRangeFilter<T extends InventoryItem> extends ItemFilt
lowerBound = addSpinner(widget, true); lowerBound = addSpinner(widget, true);
String text = "<= " + this.getCaption() + " <="; String text = "<= " + this.getCaption() + " <=";
label = new FLabel.Builder().text(text).align(HAlignment.CENTER).font(ListLabelFilter.LABEL_FONT).build(); label = new FLabel.Builder().text(text).align(Align.center).font(ListLabelFilter.LABEL_FONT).build();
widget.add(label); widget.add(label);
upperBound = addSpinner(widget, false); upperBound = addSpinner(widget, false);

View File

@@ -37,9 +37,9 @@ import java.util.Map.Entry;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Align;
public class ImageView<T extends InventoryItem> extends ItemView<T> { public class ImageView<T extends InventoryItem> extends ItemView<T> {
private static final float PADDING = Utils.scale(5); private static final float PADDING = Utils.scale(5);
@@ -789,7 +789,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
float x = GROUP_HEADER_GLYPH_WIDTH + PADDING + 1; float x = GROUP_HEADER_GLYPH_WIDTH + PADDING + 1;
float y = 0; float y = 0;
String caption = name + " (" + items.size() + ")"; String caption = name + " (" + items.size() + ")";
g.drawText(caption, GROUP_HEADER_FONT, GROUP_HEADER_FORE_COLOR, x, y, getWidth(), GROUP_HEADER_HEIGHT, false, HAlignment.LEFT, true); g.drawText(caption, GROUP_HEADER_FONT, GROUP_HEADER_FORE_COLOR, x, y, getWidth(), GROUP_HEADER_HEIGHT, false, Align.left, true);
x += GROUP_HEADER_FONT.getBounds(caption).width + PADDING; x += GROUP_HEADER_FONT.getBounds(caption).width + PADDING;
y += GROUP_HEADER_HEIGHT / 2; y += GROUP_HEADER_HEIGHT / 2;
g.drawLine(GROUP_HEADER_LINE_THICKNESS, GROUP_HEADER_LINE_COLOR, x, y, getWidth(), y); g.drawLine(GROUP_HEADER_LINE_THICKNESS, GROUP_HEADER_LINE_COLOR, x, y, getWidth(), y);
@@ -963,7 +963,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
} }
else { else {
g.fillRect(Color.BLACK, x, y, w, h); g.fillRect(Color.BLACK, x, y, w, h);
g.drawText(item.getName(), GROUP_HEADER_FONT, Color.WHITE, x + PADDING, y + PADDING, w - 2 * PADDING, h - 2 * PADDING, true, HAlignment.CENTER, false); g.drawText(item.getName(), GROUP_HEADER_FONT, Color.WHITE, x + PADDING, y + PADDING, w - 2 * PADDING, h - 2 * PADDING, true, Align.center, false);
} }
} }
} }

View File

@@ -1,13 +1,12 @@
package forge.menu; package forge.menu;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.graphics.g2d.BitmapFont.TextBounds;
import forge.Graphics; import forge.Graphics;
import forge.assets.FSkinColor; import forge.assets.FSkinColor;
import forge.assets.FSkinFont; import forge.assets.FSkinFont;
import forge.assets.TextRenderer; import forge.assets.TextRenderer;
import forge.toolbox.FDisplayObject; import forge.toolbox.FDisplayObject;
import forge.util.TextBounds;
import forge.util.Utils; import forge.util.Utils;
public class FMagnifyView extends FDropDown { public class FMagnifyView extends FDropDown {
@@ -66,6 +65,6 @@ public class FMagnifyView extends FDropDown {
public void drawBackground(Graphics g) { public void drawBackground(Graphics g) {
super.drawBackground(g); super.drawBackground(g);
g.fillRect(backColor, 0, 0, getWidth(), getHeight()); g.fillRect(backColor, 0, 0, getWidth(), getHeight());
renderer.drawText(g, text, font, foreColor, PADDING - getScrollLeft(), PADDING - getScrollTop(), getScrollWidth() - 2 * PADDING, getScrollHeight() - 2 * PADDING, 0, getHeight(), true, HAlignment.LEFT, false); renderer.drawText(g, text, font, foreColor, PADDING - getScrollLeft(), PADDING - getScrollTop(), getScrollWidth() - 2 * PADDING, getScrollHeight() - 2 * PADDING, 0, getHeight(), true, Align.left, false);
} }
} }

View File

@@ -1,6 +1,6 @@
package forge.menu; package forge.menu;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.Timer; import com.badlogic.gdx.utils.Timer;
import com.badlogic.gdx.utils.Timer.Task; import com.badlogic.gdx.utils.Timer.Task;
@@ -135,10 +135,10 @@ public class FMenuItem extends FDisplayObject implements IButton {
} }
if (textRenderer == null) { if (textRenderer == null) {
g.drawText(text, FONT, FORE_COLOR, x, 0, w - x - GAP_X, h, false, HAlignment.LEFT, true); g.drawText(text, FONT, FORE_COLOR, x, 0, w - x - GAP_X, h, false, Align.left, true);
} }
else { else {
textRenderer.drawText(g, text, FONT, FORE_COLOR, x, 0, w - x - GAP_X, h, 0, h, false, HAlignment.LEFT, true); textRenderer.drawText(g, text, FONT, FORE_COLOR, x, 0, w - x - GAP_X, h, 0, h, false, Align.left, true);
} }
//draw separator line //draw separator line

View File

@@ -1,6 +1,6 @@
package forge.menu; package forge.menu;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import forge.Graphics; import forge.Graphics;
import forge.assets.FSkinColor; import forge.assets.FSkinColor;
@@ -99,6 +99,6 @@ public class FMenuTab extends FDisplayObject {
y = PADDING; y = PADDING;
w = getWidth() - 2 * PADDING; w = getWidth() - 2 * PADDING;
h = getHeight() - 2 * PADDING; h = getHeight() - 2 * PADDING;
g.drawText(text, FONT, foreColor, x, y, w, h, false, HAlignment.CENTER, true); g.drawText(text, FONT, foreColor, x, y, w, h, false, Align.center, true);
} }
} }

View File

@@ -1,8 +1,6 @@
package forge.menu; package forge.menu;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.graphics.g2d.BitmapFont.TextBounds;
import forge.Forge; import forge.Forge;
import forge.Graphics; import forge.Graphics;
import forge.assets.FSkinColor; import forge.assets.FSkinColor;
@@ -10,6 +8,7 @@ import forge.assets.FSkinFont;
import forge.assets.FSkinColor.Colors; import forge.assets.FSkinColor.Colors;
import forge.screens.FScreen; import forge.screens.FScreen;
import forge.toolbox.FDisplayObject; import forge.toolbox.FDisplayObject;
import forge.util.TextBounds;
import forge.util.Utils; import forge.util.Utils;
public class FTooltip extends FDropDown { public class FTooltip extends FDropDown {
@@ -68,6 +67,6 @@ public class FTooltip extends FDropDown {
@Override @Override
public void drawBackground(Graphics g) { public void drawBackground(Graphics g) {
super.drawBackground(g); super.drawBackground(g);
g.drawText(text, FONT, FORE_COLOR, PADDING - getScrollLeft(), PADDING - getScrollTop(), getScrollWidth() - 2 * PADDING, getScrollHeight() - 2 * PADDING, true, HAlignment.LEFT, false); g.drawText(text, FONT, FORE_COLOR, PADDING - getScrollLeft(), PADDING - getScrollTop(), getScrollWidth() - 2 * PADDING, getScrollHeight() - 2 * PADDING, true, Align.left, false);
} }
} }

View File

@@ -3,8 +3,8 @@ package forge.screens;
import java.util.List; import java.util.List;
import com.badlogic.gdx.Input.Keys; import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.utils.Align;
import forge.Forge; import forge.Forge;
import forge.Graphics; import forge.Graphics;
@@ -197,13 +197,13 @@ public abstract class FScreen extends FContainer {
protected final FLabel btnBack, lblCaption; protected final FLabel btnBack, lblCaption;
public DefaultHeader(String headerCaption) { public DefaultHeader(String headerCaption) {
btnBack = add(new FLabel.Builder().icon(new BackIcon(HEIGHT, HEIGHT)).pressedColor(BTN_PRESSED_COLOR).align(HAlignment.CENTER).command(new FEventHandler() { btnBack = add(new FLabel.Builder().icon(new BackIcon(HEIGHT, HEIGHT)).pressedColor(BTN_PRESSED_COLOR).align(Align.center).command(new FEventHandler() {
@Override @Override
public void handleEvent(FEvent e) { public void handleEvent(FEvent e) {
Forge.back(); Forge.back();
} }
}).build()); }).build());
lblCaption = add(new FLabel.Builder().text(headerCaption).font(FONT).align(HAlignment.CENTER).build()); lblCaption = add(new FLabel.Builder().text(headerCaption).font(FONT).align(Align.center).build());
} }
@Override @Override
@@ -245,7 +245,7 @@ public abstract class FScreen extends FContainer {
public MenuHeader(String headerCaption, FPopupMenu menu0) { public MenuHeader(String headerCaption, FPopupMenu menu0) {
super(headerCaption); super(headerCaption);
menu = menu0; menu = menu0;
btnMenu = add(new FLabel.Builder().icon(new MenuIcon(HEIGHT, HEIGHT)).pressedColor(BTN_PRESSED_COLOR).align(HAlignment.CENTER).command(new FEventHandler() { btnMenu = add(new FLabel.Builder().icon(new MenuIcon(HEIGHT, HEIGHT)).pressedColor(BTN_PRESSED_COLOR).align(Align.center).command(new FEventHandler() {
@Override @Override
public void handleEvent(FEvent e) { public void handleEvent(FEvent e) {
menu.show(btnMenu, 0, HEIGHT); menu.show(btnMenu, 0, HEIGHT);

View File

@@ -1,6 +1,6 @@
package forge.screens; package forge.screens;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import forge.FThreads; import forge.FThreads;
import forge.Forge; import forge.Forge;
@@ -95,6 +95,6 @@ public class LoadingOverlay extends FOverlay {
y += padding; y += padding;
g.drawImage(FSkinImage.LOGO, (getWidth() - logoSize) / 2f, y, logoSize, logoSize); g.drawImage(FSkinImage.LOGO, (getWidth() - logoSize) / 2f, y, logoSize, logoSize);
y += logoSize + padding; y += logoSize + padding;
g.drawText(caption, FONT, FORE_COLOR, x, y, panelWidth, getHeight(), false, HAlignment.CENTER, false); g.drawText(caption, FONT, FORE_COLOR, x, y, panelWidth, getHeight(), false, Align.center, false);
} }
} }

View File

@@ -2,7 +2,7 @@ package forge.screens;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import forge.Forge; import forge.Forge;
import forge.Graphics; import forge.Graphics;
@@ -94,7 +94,7 @@ public class SplashScreen extends FContainer {
String disclaimer = "Forge is not affiliated in any way with Wizards of the Coast.\n" String disclaimer = "Forge is not affiliated in any way with Wizards of the Coast.\n"
+ "Forge is open source software, released under the GNU Public License."; + "Forge is open source software, released under the GNU Public License.";
g.drawText(disclaimer, disclaimerFont, FProgressBar.SEL_FORE_COLOR, g.drawText(disclaimer, disclaimerFont, FProgressBar.SEL_FORE_COLOR,
x, y, w, disclaimerHeight, true, HAlignment.CENTER, true); x, y, w, disclaimerHeight, true, Align.center, true);
float padding = 20f / 450f * w; float padding = 20f / 450f * w;
float pbHeight = 57f / 450f * h; float pbHeight = 57f / 450f * h;
@@ -103,6 +103,6 @@ public class SplashScreen extends FContainer {
g.draw(progressBar); g.draw(progressBar);
String version = "v. " + Forge.CURRENT_VERSION + " (Alpha)"; String version = "v. " + Forge.CURRENT_VERSION + " (Alpha)";
g.drawText(version, disclaimerFont, FProgressBar.SEL_FORE_COLOR, x, getHeight() - disclaimerHeight, w, disclaimerHeight, false, HAlignment.CENTER, true); g.drawText(version, disclaimerFont, FProgressBar.SEL_FORE_COLOR, x, getHeight() - disclaimerHeight, w, disclaimerHeight, false, Align.center, true);
} }
} }

View File

@@ -1,6 +1,6 @@
package forge.screens; package forge.screens;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import forge.Forge; import forge.Forge;
import forge.Graphics; import forge.Graphics;
@@ -183,7 +183,7 @@ public class TabPageScreen<T extends TabPageScreen<T>> extends FScreen {
public TabHeader(TabPage<T>[] tabPages0, boolean showBackButton) { public TabHeader(TabPage<T>[] tabPages0, boolean showBackButton) {
tabPages = tabPages0; tabPages = tabPages0;
if (showBackButton) { if (showBackButton) {
btnBack = add(new FLabel.Builder().icon(new BackIcon(BACK_BUTTON_WIDTH, BACK_BUTTON_WIDTH)).pressedColor(BTN_PRESSED_COLOR).align(HAlignment.CENTER).command(new FEventHandler() { btnBack = add(new FLabel.Builder().icon(new BackIcon(BACK_BUTTON_WIDTH, BACK_BUTTON_WIDTH)).pressedColor(BTN_PRESSED_COLOR).align(Align.center).command(new FEventHandler() {
@Override @Override
public void handleEvent(FEvent e) { public void handleEvent(FEvent e) {
Forge.back(); Forge.back();
@@ -365,7 +365,7 @@ public class TabPageScreen<T extends TabPageScreen<T>> extends FScreen {
if (parentScreen.showCompactTabs() && !isLandscapeMode) { if (parentScreen.showCompactTabs() && !isLandscapeMode) {
h -= 2 * padding; h -= 2 * padding;
if (icon == null) { if (icon == null) {
g.drawText(caption, TAB_FONT, TAB_FORE_COLOR, padding, padding, w, h, false, HAlignment.CENTER, true); g.drawText(caption, TAB_FONT, TAB_FORE_COLOR, padding, padding, w, h, false, Align.center, true);
} }
else { else {
//center combination of icon and text //center combination of icon and text
@@ -393,13 +393,13 @@ public class TabPageScreen<T extends TabPageScreen<T>> extends FScreen {
x += iconOffset; x += iconOffset;
w -= iconOffset; w -= iconOffset;
g.startClip(x, y, w, h); g.startClip(x, y, w, h);
g.drawText(caption, font, TAB_FORE_COLOR, x, y, w, h, false, HAlignment.LEFT, true); g.drawText(caption, font, TAB_FORE_COLOR, x, y, w, h, false, Align.left, true);
g.endClip(); g.endClip();
} }
} }
else { else {
float y = h - padding - TAB_FONT.getCapHeight(); float y = h - padding - TAB_FONT.getCapHeight();
g.drawText(caption, TAB_FONT, TAB_FORE_COLOR, padding, y - padding, w, h - y + padding, false, HAlignment.CENTER, true); g.drawText(caption, TAB_FONT, TAB_FORE_COLOR, padding, y - padding, w, h - y + padding, false, Align.center, true);
if (icon != null) { if (icon != null) {
float iconHeight = y - 2 * padding; float iconHeight = y - 2 * padding;

View File

@@ -1,8 +1,8 @@
package forge.screens.achievements; package forge.screens.achievements;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.utils.Align;
import forge.Forge; import forge.Forge;
import forge.Graphics; import forge.Graphics;
@@ -54,7 +54,7 @@ public class AchievementsScreen extends FScreen {
AchievementCollection.buildComboBox(cbCollections); AchievementCollection.buildComboBox(cbCollections);
cbCollections.setSelectedIndex(0); cbCollections.setSelectedIndex(0);
cbCollections.setAlignment(HAlignment.CENTER); cbCollections.setAlignment(Align.center);
cbCollections.setChangedHandler(new FEventHandler() { cbCollections.setChangedHandler(new FEventHandler() {
@Override @Override
public void handleEvent(FEvent e) { public void handleEvent(FEvent e) {
@@ -271,11 +271,11 @@ public class AchievementsScreen extends FScreen {
if (plateY + plateHeight > 0) { if (plateY + plateHeight > 0) {
g.drawImage((FImage)achievement.getImage(), x + trophyOffset, y, trophyImageWidth, trophyHeight); g.drawImage((FImage)achievement.getImage(), x + trophyOffset, y, trophyImageWidth, trophyHeight);
g.drawImage(FSkinImage.TROPHY_PLATE, x + plateOffset, plateY, plateWidth, plateHeight); g.drawImage(FSkinImage.TROPHY_PLATE, x + plateOffset, plateY, plateWidth, plateHeight);
g.drawText(achievement.getDisplayName(), titleFont, FORE_COLOR, x + plateOffset + plateWidth * 0.075f, plateY + plateHeight * 0.05f, plateWidth * 0.85f, titleHeight, false, HAlignment.CENTER, true); g.drawText(achievement.getDisplayName(), titleFont, FORE_COLOR, x + plateOffset + plateWidth * 0.075f, plateY + plateHeight * 0.05f, plateWidth * 0.85f, titleHeight, false, Align.center, true);
String subTitle = achievement.getSubTitle(false); String subTitle = achievement.getSubTitle(false);
if (subTitle != null) { if (subTitle != null) {
g.drawText(subTitle, subTitleFont, FORE_COLOR, x + plateOffset + plateWidth * 0.075f, plateY + plateHeight * 0.6f, plateWidth * 0.85f, subTitleHeight, false, HAlignment.CENTER, true); g.drawText(subTitle, subTitleFont, FORE_COLOR, x + plateOffset + plateWidth * 0.075f, plateY + plateHeight * 0.6f, plateWidth * 0.85f, subTitleHeight, false, Align.center, true);
} }
if (achievement == selectedAchievement) { if (achievement == selectedAchievement) {
@@ -338,40 +338,40 @@ public class AchievementsScreen extends FScreen {
y += PADDING; y += PADDING;
w -= 2 * PADDING; w -= 2 * PADDING;
h -= 2 * PADDING; h -= 2 * PADDING;
g.drawText(selectedAchievement.getDisplayName(), NAME_FONT, TEXT_COLOR, x, y, w, h, false, HAlignment.LEFT, false); g.drawText(selectedAchievement.getDisplayName(), NAME_FONT, TEXT_COLOR, x, y, w, h, false, Align.left, false);
y += NAME_FONT.getLineHeight(); y += NAME_FONT.getLineHeight();
if (subTitle != null) { if (subTitle != null) {
g.drawText(subTitle, DESC_FONT, TEXT_COLOR, x, y, w, h, false, HAlignment.LEFT, false); g.drawText(subTitle, DESC_FONT, TEXT_COLOR, x, y, w, h, false, Align.left, false);
y += DESC_FONT.getLineHeight(); y += DESC_FONT.getLineHeight();
} }
y += PADDING; y += PADDING;
if (sharedDesc != null) { if (sharedDesc != null) {
g.drawText(selectedAchievement.isSpecial() ? sharedDesc : sharedDesc + "...", DESC_FONT, TEXT_COLOR, g.drawText(selectedAchievement.isSpecial() ? sharedDesc : sharedDesc + "...", DESC_FONT, TEXT_COLOR,
x, y, w, h, false, HAlignment.LEFT, false); x, y, w, h, false, Align.left, false);
y += DESC_FONT.getLineHeight(); y += DESC_FONT.getLineHeight();
} }
if (mythicDesc != null) { if (mythicDesc != null) {
g.drawText(selectedAchievement.isSpecial() ? mythicDesc : "(Mythic) " + mythicDesc, DESC_FONT, //handle flavor text here too g.drawText(selectedAchievement.isSpecial() ? mythicDesc : "(Mythic) " + mythicDesc, DESC_FONT, //handle flavor text here too
selectedAchievement.earnedMythic() ? TEXT_COLOR : NOT_EARNED_COLOR, selectedAchievement.earnedMythic() ? TEXT_COLOR : NOT_EARNED_COLOR,
x, y, w, h, false, HAlignment.LEFT, false); x, y, w, h, false, Align.left, false);
y += DESC_FONT.getLineHeight(); y += DESC_FONT.getLineHeight();
} }
if (rareDesc != null) { if (rareDesc != null) {
g.drawText("(Rare) " + rareDesc, DESC_FONT, g.drawText("(Rare) " + rareDesc, DESC_FONT,
selectedAchievement.earnedRare() ? TEXT_COLOR : NOT_EARNED_COLOR, selectedAchievement.earnedRare() ? TEXT_COLOR : NOT_EARNED_COLOR,
x, y, w, h, false, HAlignment.LEFT, false); x, y, w, h, false, Align.left, false);
y += DESC_FONT.getLineHeight(); y += DESC_FONT.getLineHeight();
} }
if (uncommonDesc != null) { if (uncommonDesc != null) {
g.drawText("(Uncommon) " + uncommonDesc, DESC_FONT, g.drawText("(Uncommon) " + uncommonDesc, DESC_FONT,
selectedAchievement.earnedUncommon() ? TEXT_COLOR : NOT_EARNED_COLOR, selectedAchievement.earnedUncommon() ? TEXT_COLOR : NOT_EARNED_COLOR,
x, y, w, h, false, HAlignment.LEFT, false); x, y, w, h, false, Align.left, false);
y += DESC_FONT.getLineHeight(); y += DESC_FONT.getLineHeight();
} }
if (commonDesc != null) { if (commonDesc != null) {
g.drawText("(Common) " + commonDesc, DESC_FONT, g.drawText("(Common) " + commonDesc, DESC_FONT,
selectedAchievement.earnedCommon() ? TEXT_COLOR : NOT_EARNED_COLOR, selectedAchievement.earnedCommon() ? TEXT_COLOR : NOT_EARNED_COLOR,
x, y, w, h, false, HAlignment.LEFT, false); x, y, w, h, false, Align.left, false);
} }
} }
} }

View File

@@ -19,7 +19,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
public class AvatarSelector extends FScreen { public class AvatarSelector extends FScreen {
public static int getRandomAvatar(List<Integer> usedAvatars) { public static int getRandomAvatar(List<Integer> usedAvatars) {
@@ -87,7 +87,7 @@ public class AvatarSelector extends FScreen {
} }
private void addAvatarLabel(final FImage img, final int index) { private void addAvatarLabel(final FImage img, final int index) {
final FLabel lbl = new FLabel.Builder().icon(img).iconScaleFactor(0.95f).align(HAlignment.CENTER) final FLabel lbl = new FLabel.Builder().icon(img).iconScaleFactor(0.95f).align(Align.center)
.iconInBackground(true).selectable(true).selected(currentIndex == index) .iconInBackground(true).selectable(true).selected(currentIndex == index)
.build(); .build();

View File

@@ -6,7 +6,7 @@ import forge.deck.*;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import forge.FThreads; import forge.FThreads;
@@ -413,10 +413,10 @@ public abstract class LobbyScreen extends LaunchScreen implements ILobbyView {
float totalHeight = h; float totalHeight = h;
h = font.getMultiLineBounds(text).height + SettingsScreen.SETTING_PADDING; h = font.getMultiLineBounds(text).height + SettingsScreen.SETTING_PADDING;
g.drawText(text, font, foreColor, x, y, w, h, false, HAlignment.LEFT, false); g.drawText(text, font, foreColor, x, y, w, h, false, Align.left, false);
value.draw(g, font, foreColor, x, y, w, h); value.draw(g, font, foreColor, x, y, w, h);
h += SettingsScreen.SETTING_PADDING; h += SettingsScreen.SETTING_PADDING;
g.drawText(value.gameType.getDescription(), SettingsScreen.DESC_FONT, SettingsScreen.DESC_COLOR, x, y + h, w, totalHeight - h + SettingsScreen.getInsets(w), true, HAlignment.LEFT, false); g.drawText(value.gameType.getDescription(), SettingsScreen.DESC_FONT, SettingsScreen.DESC_COLOR, x, y + h, w, totalHeight - h + SettingsScreen.getInsets(w), true, Align.left, false);
} }
} }
} }

View File

@@ -5,8 +5,7 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
@@ -835,7 +834,7 @@ public class PlayerPanel extends FContainer {
/** Adds a pre-styled FLabel component with the specified title. */ /** Adds a pre-styled FLabel component with the specified title. */
private FLabel newLabel(String title) { private FLabel newLabel(String title) {
return new FLabel.Builder().text(title).font(LABEL_FONT).align(HAlignment.RIGHT).build(); return new FLabel.Builder().text(title).font(LABEL_FONT).align(Align.right).build();
} }
private static final ImmutableList<String> genderOptions = ImmutableList.of("Male", "Female", "Any"); private static final ImmutableList<String> genderOptions = ImmutableList.of("Male", "Female", "Any");

View File

@@ -6,8 +6,7 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import forge.FThreads; import forge.FThreads;
import forge.Graphics; import forge.Graphics;
@@ -253,8 +252,8 @@ public class LoadGauntletScreen extends LaunchScreen {
String progress = completed + " / " + opponents + " (" + percent.format((double)completed / (double)opponents) + ")"; String progress = completed + " / " + opponents + " (" + percent.format((double)completed / (double)opponents) + ")";
float progressWidth = font.getBounds(progress).width + SettingsScreen.SETTING_PADDING; float progressWidth = font.getBounds(progress).width + SettingsScreen.SETTING_PADDING;
g.drawText(name, font, foreColor, x, y, w - progressWidth, h, false, HAlignment.LEFT, false); g.drawText(name, font, foreColor, x, y, w - progressWidth, h, false, Align.left, false);
g.drawText(progress, font, foreColor, x, y, w, h, false, HAlignment.RIGHT, false); g.drawText(progress, font, foreColor, x, y, w, h, false, Align.right, false);
h += SettingsScreen.SETTING_PADDING; h += SettingsScreen.SETTING_PADDING;
y += h; y += h;
@@ -263,8 +262,8 @@ public class LoadGauntletScreen extends LaunchScreen {
String timestamp = value.getTimestamp(); String timestamp = value.getTimestamp();
font = FSkinFont.get(12); font = FSkinFont.get(12);
float timestampWidth = font.getBounds(timestamp).width + SettingsScreen.SETTING_PADDING; float timestampWidth = font.getBounds(timestamp).width + SettingsScreen.SETTING_PADDING;
g.drawText(value.getUserDeck() == null ? "(none)" : value.getUserDeck().getName(), font, SettingsScreen.DESC_COLOR, x, y, w - timestampWidth, h, false, HAlignment.LEFT, false); g.drawText(value.getUserDeck() == null ? "(none)" : value.getUserDeck().getName(), font, SettingsScreen.DESC_COLOR, x, y, w - timestampWidth, h, false, Align.left, false);
g.drawText(timestamp, font, SettingsScreen.DESC_COLOR, x + w - timestampWidth + SettingsScreen.SETTING_PADDING, y, w, h, false, HAlignment.LEFT, false); g.drawText(timestamp, font, SettingsScreen.DESC_COLOR, x + w - timestampWidth + SettingsScreen.SETTING_PADDING, y, w, h, false, Align.left, false);
} }
}); });
} }

View File

@@ -3,7 +3,7 @@ package forge.screens.home;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import forge.Forge; import forge.Forge;
import forge.Graphics; import forge.Graphics;
import forge.assets.FSkinColor; import forge.assets.FSkinColor;
@@ -247,7 +247,7 @@ public class HomeScreen extends FScreen {
public void draw(Graphics g) { public void draw(Graphics g) {
if (Forge.isLandscapeMode()) { if (Forge.isLandscapeMode()) {
//draw text only for Landscape mode //draw text only for Landscape mode
g.drawText(getText(), getFont(), getForeColor(), 0, 0, getWidth(), getHeight(), false, HAlignment.LEFT, true); g.drawText(getText(), getFont(), getForeColor(), 0, 0, getWidth(), getHeight(), false, Align.left, true);
} }
else { //draw buttons normally for portrait mode else { //draw buttons normally for portrait mode
super.draw(g); super.draw(g);

View File

@@ -1,6 +1,6 @@
package forge.screens.limited; package forge.screens.limited;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import forge.FThreads; import forge.FThreads;
import forge.Forge; import forge.Forge;
@@ -39,7 +39,7 @@ public class LoadDraftScreen extends LaunchScreen {
private final FLabel lblTip = add(new FLabel.Builder() private final FLabel lblTip = add(new FLabel.Builder()
.text("Double-tap to edit deck (Long-press to view)") .text("Double-tap to edit deck (Long-press to view)")
.textColor(FLabel.INLINE_LABEL_COLOR) .textColor(FLabel.INLINE_LABEL_COLOR)
.align(HAlignment.CENTER).font(FSkinFont.get(12)).build()); .align(Align.center).font(FSkinFont.get(12)).build());
private final FSkinFont GAME_MODE_FONT= FSkinFont.get(12); private final FSkinFont GAME_MODE_FONT= FSkinFont.get(12);
private final FLabel lblMode = add(new FLabel.Builder().text("Mode:").font(GAME_MODE_FONT).build()); private final FLabel lblMode = add(new FLabel.Builder().text("Mode:").font(GAME_MODE_FONT).build());

View File

@@ -1,6 +1,6 @@
package forge.screens.limited; package forge.screens.limited;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import forge.FThreads; import forge.FThreads;
import forge.Forge; import forge.Forge;
@@ -39,7 +39,7 @@ public class LoadSealedScreen extends LaunchScreen {
private final FLabel lblTip = add(new FLabel.Builder() private final FLabel lblTip = add(new FLabel.Builder()
.text("Double-tap to edit deck (Long-press to view)") .text("Double-tap to edit deck (Long-press to view)")
.textColor(FLabel.INLINE_LABEL_COLOR) .textColor(FLabel.INLINE_LABEL_COLOR)
.align(HAlignment.CENTER).font(FSkinFont.get(12)).build()); .align(Align.center).font(FSkinFont.get(12)).build());
private final FSkinFont GAME_MODE_FONT= FSkinFont.get(12); private final FSkinFont GAME_MODE_FONT= FSkinFont.get(12);
private final FLabel lblMode = add(new FLabel.Builder().text("Mode:").font(GAME_MODE_FONT).build()); private final FLabel lblMode = add(new FLabel.Builder().text("Mode:").font(GAME_MODE_FONT).build());

View File

@@ -48,7 +48,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
public class VAssignDamage extends FDialog { public class VAssignDamage extends FDialog {
private static final float CARD_GAP_X = Utils.scale(10); private static final float CARD_GAP_X = Utils.scale(10);
@@ -64,8 +64,8 @@ public class VAssignDamage extends FDialog {
private final GameEntityView defender; private final GameEntityView defender;
private final FLabel lblTotalDamage = add(new FLabel.Builder().text("Available damage points: Unknown").align(HAlignment.CENTER).build()); private final FLabel lblTotalDamage = add(new FLabel.Builder().text("Available damage points: Unknown").align(Align.center).build());
private final FLabel lblAssignRemaining = add(new FLabel.Builder().text("Distribute the remaining damage points among lethally wounded entities").align(HAlignment.CENTER).build()); private final FLabel lblAssignRemaining = add(new FLabel.Builder().text("Distribute the remaining damage points among lethally wounded entities").align(Align.center).build());
private final AttDefCardPanel pnlAttacker; private final AttDefCardPanel pnlAttacker;
private final DefendersPanel pnlDefenders; private final DefendersPanel pnlDefenders;
@@ -215,7 +215,7 @@ public class VAssignDamage extends FDialog {
else { else {
obj = add(new MiscAttDefPanel(defender.toString(), FSkinImage.UNKNOWN)); obj = add(new MiscAttDefPanel(defender.toString(), FSkinImage.UNKNOWN));
} }
label = add(new FLabel.Builder().text("0").font(FSkinFont.get(18)).align(HAlignment.CENTER).build()); label = add(new FLabel.Builder().text("0").font(FSkinFont.get(18)).align(Align.center).build());
btnSubtract = add(new FLabel.ButtonBuilder().icon(FSkinImage.MINUS).command(new FEventHandler() { btnSubtract = add(new FLabel.ButtonBuilder().icon(FSkinImage.MINUS).command(new FEventHandler() {
@Override @Override
public void handleEvent(FEvent e) { public void handleEvent(FEvent e) {
@@ -284,7 +284,7 @@ public class VAssignDamage extends FDialog {
float w = getWidth(); float w = getWidth();
float h = getHeight(); float h = getHeight();
g.drawImage(image, 0, 0, w, w); g.drawImage(image, 0, 0, w, w);
g.drawText(name, FONT, FORE_COLOR, 0, w, w, h - w, false, HAlignment.CENTER, true); g.drawText(name, FONT, FORE_COLOR, 0, w, w, h - w, false, Align.center, true);
} }
} }

View File

@@ -3,8 +3,6 @@ package forge.screens.match.views;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.badlogic.gdx.graphics.g2d.BitmapFont.TextBounds;
import forge.screens.match.MatchController; import forge.screens.match.MatchController;
import forge.toolbox.FCheckBox; import forge.toolbox.FCheckBox;
import forge.toolbox.FChoiceList; import forge.toolbox.FChoiceList;
@@ -12,6 +10,7 @@ import forge.toolbox.FDialog;
import forge.toolbox.FEvent; import forge.toolbox.FEvent;
import forge.toolbox.FEvent.FEventHandler; import forge.toolbox.FEvent.FEventHandler;
import forge.toolbox.FOptionPane; import forge.toolbox.FOptionPane;
import forge.util.TextBounds;
public class VAutoYields extends FDialog { public class VAutoYields extends FDialog {
private final FChoiceList<String> lstAutoYields; private final FChoiceList<String> lstAutoYields;

View File

@@ -1,8 +1,8 @@
package forge.screens.match.views; package forge.screens.match.views;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Align;
import forge.Graphics; import forge.Graphics;
import forge.assets.FImage; import forge.assets.FImage;
@@ -70,7 +70,7 @@ public class VAvatar extends FDisplayObject {
//use font and padding from phase indicator so text lines up //use font and padding from phase indicator so text lines up
FSkinFont font = VPhaseIndicator.BASE_FONT; FSkinFont font = VPhaseIndicator.BASE_FONT;
float xpHeight = font.getCapHeight(); float xpHeight = font.getCapHeight();
g.drawOutlinedText(xp + " XP", font, Color.WHITE, Color.BLACK, 0, h - xpHeight - VPhaseIndicator.PADDING_Y, w - VPhaseIndicator.PADDING_X, h, false, HAlignment.RIGHT, false); g.drawOutlinedText(xp + " XP", font, Color.WHITE, Color.BLACK, 0, h - xpHeight - VPhaseIndicator.PADDING_Y, w - VPhaseIndicator.PADDING_X, h, false, Align.right, false);
} }
} }
} }

View File

@@ -2,7 +2,7 @@ package forge.screens.match.views;
import java.util.List; import java.util.List;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import forge.Graphics; import forge.Graphics;
import forge.assets.FSkinColor; import forge.assets.FSkinColor;
@@ -108,7 +108,7 @@ public class VLog extends FDropDown {
} }
//use full height without padding so text not scaled down //use full height without padding so text not scaled down
renderer.drawText(g, text, FONT, FORE_COLOR, PADDING, PADDING, w - 2 * PADDING, h, 0, h, true, HAlignment.LEFT, false); renderer.drawText(g, text, FONT, FORE_COLOR, PADDING, PADDING, w - 2 * PADDING, h, 0, h, true, Align.left, false);
} }
} }
} }

View File

@@ -3,7 +3,7 @@ package forge.screens.match.views;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import forge.Forge; import forge.Forge;
import forge.Graphics; import forge.Graphics;
@@ -148,7 +148,7 @@ public class VManaPool extends VDisplayArea {
w = getWidth(); w = getWidth();
h = getHeight() - y; h = getHeight() - y;
g.drawText(text, FONT, FORE_COLOR, x, y, w, h, false, HAlignment.CENTER, false); g.drawText(text, FONT, FORE_COLOR, x, y, w, h, false, Align.center, false);
} }
} }
} }

View File

@@ -4,8 +4,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.graphics.g2d.BitmapFont.TextBounds;
import forge.Graphics; import forge.Graphics;
import forge.assets.FSkinColor; import forge.assets.FSkinColor;
@@ -14,6 +13,7 @@ import forge.assets.FSkinColor.Colors;
import forge.game.phase.PhaseType; import forge.game.phase.PhaseType;
import forge.toolbox.FContainer; import forge.toolbox.FContainer;
import forge.toolbox.FDisplayObject; import forge.toolbox.FDisplayObject;
import forge.util.TextBounds;
import forge.util.Utils; import forge.util.Utils;
public class VPhaseIndicator extends FContainer { public class VPhaseIndicator extends FContainer {
@@ -160,7 +160,7 @@ public class VPhaseIndicator extends FContainer {
backColor = FSkinColor.get(Colors.CLR_PHASE_INACTIVE_DISABLED); backColor = FSkinColor.get(Colors.CLR_PHASE_INACTIVE_DISABLED);
} }
g.fillRect(backColor, x, 0, w, h); g.fillRect(backColor, x, 0, w, h);
g.drawText(caption, font, Color.BLACK, x, 0, w, h, false, HAlignment.CENTER, true); g.drawText(caption, font, Color.BLACK, x, 0, w, h, false, Align.center, true);
} }
} }
} }

View File

@@ -6,7 +6,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import forge.Forge; import forge.Forge;
import forge.Graphics; import forge.Graphics;
@@ -392,21 +392,21 @@ public class VPlayerPanel extends FContainer {
@Override @Override
public void draw(Graphics g) { public void draw(Graphics g) {
if (poisonCounters == 0 && energyCounters == 0) { if (poisonCounters == 0 && energyCounters == 0) {
g.drawText(lifeStr, LIFE_FONT, INFO_FORE_COLOR, 0, 0, getWidth(), getHeight(), false, HAlignment.CENTER, true); g.drawText(lifeStr, LIFE_FONT, INFO_FORE_COLOR, 0, 0, getWidth(), getHeight(), false, Align.center, true);
} }
else { else {
float halfHeight = getHeight() / 2; float halfHeight = getHeight() / 2;
float textStart = halfHeight + Utils.scale(1); float textStart = halfHeight + Utils.scale(1);
float textWidth = getWidth() - textStart; float textWidth = getWidth() - textStart;
g.drawImage(FSkinImage.QUEST_LIFE, 0, 0, halfHeight, halfHeight); g.drawImage(FSkinImage.QUEST_LIFE, 0, 0, halfHeight, halfHeight);
g.drawText(lifeStr, INFO_FONT, INFO_FORE_COLOR, textStart, 0, textWidth, halfHeight, false, HAlignment.CENTER, true); g.drawText(lifeStr, INFO_FONT, INFO_FORE_COLOR, textStart, 0, textWidth, halfHeight, false, Align.center, true);
if (poisonCounters > 0) { //prioritize showing poison counters over energy counters if (poisonCounters > 0) { //prioritize showing poison counters over energy counters
g.drawImage(FSkinImage.POISON, 0, halfHeight, halfHeight, halfHeight); g.drawImage(FSkinImage.POISON, 0, halfHeight, halfHeight, halfHeight);
g.drawText(String.valueOf(poisonCounters), INFO_FONT, INFO_FORE_COLOR, textStart, halfHeight, textWidth, halfHeight, false, HAlignment.CENTER, true); g.drawText(String.valueOf(poisonCounters), INFO_FONT, INFO_FORE_COLOR, textStart, halfHeight, textWidth, halfHeight, false, Align.center, true);
} }
else { else {
g.drawImage(FSkinImage.ENERGY, 0, halfHeight, halfHeight, halfHeight); g.drawImage(FSkinImage.ENERGY, 0, halfHeight, halfHeight, halfHeight);
g.drawText(String.valueOf(energyCounters), INFO_FONT, INFO_FORE_COLOR, textStart, halfHeight, textWidth, halfHeight, false, HAlignment.CENTER, true); g.drawText(String.valueOf(energyCounters), INFO_FONT, INFO_FORE_COLOR, textStart, halfHeight, textWidth, halfHeight, false, Align.center, true);
} }
} }
} }
@@ -510,10 +510,10 @@ public class VPlayerPanel extends FContainer {
} }
x += w + INFO_TAB_PADDING_X; x += w + INFO_TAB_PADDING_X;
HAlignment alignX = HAlignment.LEFT; int alignX = Align.left;
if (lblLife.getRotate180()) { if (lblLife.getRotate180()) {
g.startRotateTransform(x + (getWidth() - x + 1) / 2, getHeight() / 2, 180); g.startRotateTransform(x + (getWidth() - x + 1) / 2, getHeight() / 2, 180);
alignX = HAlignment.RIGHT; alignX = Align.right;
} }
g.drawText(value, INFO_FONT, INFO_FORE_COLOR, x, 0, getWidth() - x + 1, getHeight(), false, alignX, true); g.drawText(value, INFO_FONT, INFO_FORE_COLOR, x, 0, getWidth() - x + 1, getHeight(), false, alignX, true);
if (lblLife.getRotate180()) { if (lblLife.getRotate180()) {
@@ -535,7 +535,7 @@ public class VPlayerPanel extends FContainer {
g.drawImage(icon, x, y, w, h); g.drawImage(icon, x, y, w, h);
y += h + INFO_TAB_PADDING_Y; y += h + INFO_TAB_PADDING_Y;
g.drawText(value, INFO_FONT, INFO_FORE_COLOR, 0, y, getWidth(), getHeight() - y + 1, false, HAlignment.CENTER, false); g.drawText(value, INFO_FONT, INFO_FORE_COLOR, 0, y, getWidth(), getHeight() - y + 1, false, Align.center, false);
if (lblLife.getRotate180()) { if (lblLife.getRotate180()) {
g.endTransform(); g.endTransform();
} }

View File

@@ -1,6 +1,6 @@
package forge.screens.match.views; package forge.screens.match.views;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import forge.Graphics; import forge.Graphics;
import forge.assets.FImage; import forge.assets.FImage;
@@ -62,7 +62,7 @@ public class VPlayers extends FDropDown {
g.drawImage(avatarImage, x, y, h, h); g.drawImage(avatarImage, x, y, h, h);
x += h + PADDING; x += h + PADDING;
g.drawText(player.getDetails(), FONT, FList.FORE_COLOR, x, y, getWidth() - PADDING - x, h, true, HAlignment.LEFT, true); g.drawText(player.getDetails(), FONT, FList.FORE_COLOR, x, y, getWidth() - PADDING - x, h, true, Align.left, true);
} }
@Override @Override

View File

@@ -2,9 +2,7 @@ package forge.screens.match.views;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.graphics.g2d.BitmapFont.TextBounds;
import forge.Graphics; import forge.Graphics;
import forge.assets.FSkinColor; import forge.assets.FSkinColor;
import forge.assets.FSkinFont; import forge.assets.FSkinFont;
@@ -18,6 +16,7 @@ import forge.toolbox.FButton.Corner;
import forge.toolbox.FContainer; import forge.toolbox.FContainer;
import forge.toolbox.FDisplayObject; import forge.toolbox.FDisplayObject;
import forge.toolbox.FEvent.FEventHandler; import forge.toolbox.FEvent.FEventHandler;
import forge.util.TextBounds;
import forge.util.Utils; import forge.util.Utils;
public class VPrompt extends FContainer { public class VPrompt extends FContainer {
@@ -125,7 +124,7 @@ public class VPrompt extends FContainer {
float y = PADDING; float y = PADDING;
float w = getWidth() - 2 * PADDING; float w = getWidth() - 2 * PADDING;
float h = getHeight() - 2 * PADDING; float h = getHeight() - 2 * PADDING;
renderer.drawText(g, message, FONT, FORE_COLOR, x, y, w, h, y, h, true, HAlignment.CENTER, true); renderer.drawText(g, message, FONT, FORE_COLOR, x, y, w, h, y, h, true, Align.center, true);
} }
} }
} }

View File

@@ -6,8 +6,8 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Align;
import forge.Forge; import forge.Forge;
import forge.Graphics; import forge.Graphics;
@@ -133,7 +133,7 @@ public class VStack extends FDropDown {
final FCollectionView<StackItemView> stack = MatchController.instance.getGameView().getStack(); final FCollectionView<StackItemView> stack = MatchController.instance.getGameView().getStack();
if (stack.isEmpty()) { //show label if stack empty if (stack.isEmpty()) { //show label if stack empty
FLabel label = add(new FLabel.Builder().text("[Empty]").font(FONT).align(HAlignment.CENTER).build()); FLabel label = add(new FLabel.Builder().text("[Empty]").font(FONT).align(Align.center).build());
float height = Math.round(label.getAutoSizeBounds().height) + 2 * PADDING; float height = Math.round(label.getAutoSizeBounds().height) + 2 * PADDING;
label.setBounds(x, y, width, height); label.setBounds(x, y, width, height);
@@ -371,7 +371,7 @@ public class VStack extends FDropDown {
x += CARD_WIDTH + PADDING; x += CARD_WIDTH + PADDING;
w -= x + PADDING - BORDER_THICKNESS; w -= x + PADDING - BORDER_THICKNESS;
h -= y + PADDING - BORDER_THICKNESS; h -= y + PADDING - BORDER_THICKNESS;
textRenderer.drawText(g, text, FONT, foreColor, x, y, w, h, y, h, true, HAlignment.LEFT, true); textRenderer.drawText(g, text, FONT, foreColor, x, y, w, h, y, h, true, Align.left, true);
g.endClip(); g.endClip();

View File

@@ -1,7 +1,7 @@
package forge.screens.match.winlose; package forge.screens.match.winlose;
import com.badlogic.gdx.Input.Keys; import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import forge.FThreads; import forge.FThreads;
import forge.Forge; import forge.Forge;
import forge.assets.FSkinColor; import forge.assets.FSkinColor;
@@ -40,8 +40,8 @@ public class ViewWinLose extends FOverlay implements IWinLoseView<FButton> {
game = game0; game = game0;
lblTitle = add(new FLabel.Builder().font(FSkinFont.get(30)).align(HAlignment.CENTER).build()); lblTitle = add(new FLabel.Builder().font(FSkinFont.get(30)).align(Align.center).build());
lblStats = add(new FLabel.Builder().font(FSkinFont.get(26)).align(HAlignment.CENTER).build()); lblStats = add(new FLabel.Builder().font(FSkinFont.get(26)).align(Align.center).build());
pnlOutcomes = add(new OutcomesPanel()); pnlOutcomes = add(new OutcomesPanel());
btnContinue = add(new FButton()); btnContinue = add(new FButton());
@@ -88,7 +88,7 @@ public class ViewWinLose extends FOverlay implements IWinLoseView<FButton> {
btnQuit.setFont(btnContinue.getFont()); btnQuit.setFont(btnContinue.getFont());
btnContinue.setEnabled(!game0.isMatchOver()); btnContinue.setEnabled(!game0.isMatchOver());
lblLog = add(new FLabel.Builder().text("Game Log").align(HAlignment.CENTER).font(FSkinFont.get(18)).build()); lblLog = add(new FLabel.Builder().text("Game Log").align(Align.center).font(FSkinFont.get(18)).build());
txtLog = add(new FTextArea(true, StringUtils.join(game.getGameLog().getLogEntries(null), "\r\n").replace("[COMPUTER]", "[AI]")) { txtLog = add(new FTextArea(true, StringUtils.join(game.getGameLog().getLogEntries(null), "\r\n").replace("[COMPUTER]", "[AI]")) {
@Override @Override
public boolean tap(float x, float y, int count) { public boolean tap(float x, float y, int count) {

View File

@@ -1,7 +1,7 @@
package forge.screens.online; package forge.screens.online;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import forge.Graphics; import forge.Graphics;
import forge.assets.FSkinColor; import forge.assets.FSkinColor;
@@ -149,7 +149,7 @@ public class OnlineChatScreen extends FScreen implements IOnlineChatInterface {
float w = getWidth() - TRIANGLE_WIDTH; float w = getWidth() - TRIANGLE_WIDTH;
float h = getHeight() - TEXT_INSET; float h = getHeight() - TEXT_INSET;
FSkinColor color = isLocal ? LOCAL_COLOR : REMOTE_COLOR; FSkinColor color = isLocal ? LOCAL_COLOR : REMOTE_COLOR;
HAlignment horzAlignment = isLocal ? HAlignment.RIGHT : HAlignment.LEFT; int horzAlignment = isLocal ? Align.right : Align.left;
float timestampHeight = FONT.getCapHeight(); float timestampHeight = FONT.getCapHeight();
//draw bubble fill //draw bubble fill

View File

@@ -5,8 +5,8 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.utils.Align;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
@@ -64,7 +64,7 @@ public class ConquestAEtherScreen extends FScreen {
private final FilterButton btnRarityFilter = add(new FilterButton("Rarity", ConquestUtil.RARITY_FILTERS)); private final FilterButton btnRarityFilter = add(new FilterButton("Rarity", ConquestUtil.RARITY_FILTERS));
private final FilterButton btnCMCFilter = add(new FilterButton("CMC", ConquestUtil.CMC_FILTERS)); private final FilterButton btnCMCFilter = add(new FilterButton("CMC", ConquestUtil.CMC_FILTERS));
private final FLabel lblShards = add(new FLabel.Builder().font(LABEL_FONT).align(HAlignment.CENTER).parseSymbols().build()); private final FLabel lblShards = add(new FLabel.Builder().font(LABEL_FONT).align(Align.center).parseSymbols().build());
private PullAnimation activePullAnimation; private PullAnimation activePullAnimation;
private int shardCost; private int shardCost;
@@ -273,7 +273,7 @@ public class ConquestAEtherScreen extends FScreen {
activePullAnimation.drawCard(g); activePullAnimation.drawCard(g);
} }
else { else {
textRenderer.drawText(g, message, MESSAGE_FONT, Color.WHITE, 0, 0, w, h, 0, h, false, HAlignment.CENTER, true); textRenderer.drawText(g, message, MESSAGE_FONT, Color.WHITE, 0, 0, w, h, 0, h, false, Align.center, true);
} }
} }
@@ -361,7 +361,7 @@ public class ConquestAEtherScreen extends FScreen {
private FilterButton(String caption0, AEtherFilter[] options0) { private FilterButton(String caption0, AEtherFilter[] options0) {
super(new FLabel.Builder().iconInBackground().pressedColor(FILTER_BUTTON_PRESSED_COLOR) super(new FLabel.Builder().iconInBackground().pressedColor(FILTER_BUTTON_PRESSED_COLOR)
.textColor(FILTER_BUTTON_TEXT_COLOR).alphaComposite(1f).align(HAlignment.CENTER)); .textColor(FILTER_BUTTON_TEXT_COLOR).alphaComposite(1f).align(Align.center));
caption = caption0; caption = caption0;
options = ImmutableList.copyOf(options0); options = ImmutableList.copyOf(options0);
setSelectedOption(options.get(0)); setSelectedOption(options.get(0));

View File

@@ -2,7 +2,7 @@ package forge.screens.planarconquest;
import java.util.Map.Entry; import java.util.Map.Entry;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import forge.Forge; import forge.Forge;
@@ -217,7 +217,7 @@ public class ConquestCommandersScreen extends FScreen {
float imageSize = CardRenderer.MANA_SYMBOL_SIZE; float imageSize = CardRenderer.MANA_SYMBOL_SIZE;
ColorSet cardColor = card.getRules().getColorIdentity(); ColorSet cardColor = card.getRules().getColorIdentity();
float availableWidth = w - cardArtWidth - CardFaceSymbols.getWidth(cardColor, imageSize) - FList.PADDING; float availableWidth = w - cardArtWidth - CardFaceSymbols.getWidth(cardColor, imageSize) - FList.PADDING;
g.drawText(card.getName(), font, foreColor, x, y, availableWidth, imageSize, false, HAlignment.LEFT, true); g.drawText(card.getName(), font, foreColor, x, y, availableWidth, imageSize, false, Align.left, true);
CardFaceSymbols.drawColorSet(g, cardColor, x + availableWidth + FList.PADDING, y, imageSize); CardFaceSymbols.drawColorSet(g, cardColor, x + availableWidth + FList.PADDING, y, imageSize);
if (compactModeHandler.isCompactMode()) { if (compactModeHandler.isCompactMode()) {
@@ -233,7 +233,7 @@ public class ConquestCommandersScreen extends FScreen {
float setWidth = CardRenderer.getSetWidth(font, set); float setWidth = CardRenderer.getSetWidth(font, set);
availableWidth = w - cardArtWidth - setWidth; availableWidth = w - cardArtWidth - setWidth;
g.drawText(commander.getOrigin() + " (" + record.getWins() + "W / " + record.getLosses() + "L)", font, foreColor, x, y, availableWidth, lineHeight, false, HAlignment.LEFT, true); g.drawText(commander.getOrigin() + " (" + record.getWins() + "W / " + record.getLosses() + "L)", font, foreColor, x, y, availableWidth, lineHeight, false, Align.left, true);
x += availableWidth + CardRenderer.SET_BOX_MARGIN; x += availableWidth + CardRenderer.SET_BOX_MARGIN;
y -= CardRenderer.SET_BOX_MARGIN; y -= CardRenderer.SET_BOX_MARGIN;

View File

@@ -6,9 +6,9 @@ import forge.planarconquest.*;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Align;
import forge.FThreads; import forge.FThreads;
import forge.Forge; import forge.Forge;
@@ -641,7 +641,7 @@ public class ConquestMultiverseScreen extends FScreen {
float y = PADDING; float y = PADDING;
float symbolSize = CardRenderer.MANA_SYMBOL_SIZE; float symbolSize = CardRenderer.MANA_SYMBOL_SIZE;
float availableNameWidth = w - CardFaceSymbols.getWidth(regionColors, symbolSize) - 3 * PADDING; float availableNameWidth = w - CardFaceSymbols.getWidth(regionColors, symbolSize) - 3 * PADDING;
g.drawText(region.toString(), PLANE_NAME_FONT, LOCATION_BAR_TEXT_COLOR, x, y, availableNameWidth, symbolSize, false, HAlignment.LEFT, true); g.drawText(region.toString(), PLANE_NAME_FONT, LOCATION_BAR_TEXT_COLOR, x, y, availableNameWidth, symbolSize, false, Align.left, true);
x += availableNameWidth + PADDING; x += availableNameWidth + PADDING;
CardFaceSymbols.drawColorSet(g, regionColors, x, y, symbolSize); CardFaceSymbols.drawColorSet(g, regionColors, x, y, symbolSize);
@@ -653,7 +653,7 @@ public class ConquestMultiverseScreen extends FScreen {
} }
x = PADDING; x = PADDING;
y += symbolSize; y += symbolSize;
g.drawText(details, EVENT_NAME_FONT, LOCATION_BAR_TEXT_COLOR, x, y, w - 2 * PADDING, h - y, false, HAlignment.CENTER, true); g.drawText(details, EVENT_NAME_FONT, LOCATION_BAR_TEXT_COLOR, x, y, w - 2 * PADDING, h - y, false, Align.center, true);
//draw top and bottom borders //draw top and bottom borders
g.drawLine(1, Color.BLACK, 0, 0, w, 0); g.drawLine(1, Color.BLACK, 0, 0, w, 0);
@@ -702,10 +702,10 @@ public class ConquestMultiverseScreen extends FScreen {
float labelHeight = playerAvatar.getTop(); float labelHeight = playerAvatar.getTop();
if (playerAvatar.card != null) { if (playerAvatar.card != null) {
g.drawText(playerAvatar.card.getName(), AVATAR_NAME_FONT, Color.WHITE, PADDING, 0, labelWidth, labelHeight, false, HAlignment.LEFT, true); g.drawText(playerAvatar.card.getName(), AVATAR_NAME_FONT, Color.WHITE, PADDING, 0, labelWidth, labelHeight, false, Align.left, true);
} }
if (opponentAvatar.card != null) { if (opponentAvatar.card != null) {
g.drawText(opponentAvatar.card.getName(), AVATAR_NAME_FONT, Color.WHITE, getWidth() - labelWidth - PADDING, getHeight() - labelHeight, labelWidth, labelHeight, false, HAlignment.RIGHT, true); g.drawText(opponentAvatar.card.getName(), AVATAR_NAME_FONT, Color.WHITE, getWidth() - labelWidth - PADDING, getHeight() - labelHeight, labelWidth, labelHeight, false, Align.right, true);
} }
} }

View File

@@ -3,8 +3,8 @@ package forge.screens.planarconquest;
import java.util.List; import java.util.List;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.utils.Align;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
@@ -206,7 +206,7 @@ public class ConquestPlaneSelector extends FDisplayObject {
float monitorBottom = monitorTop + monitorHeight; float monitorBottom = monitorTop + monitorHeight;
float remainingHeight = h - monitorBottom; float remainingHeight = h - monitorBottom;
ConquestPlane plane = getSelectedPlane(); ConquestPlane plane = getSelectedPlane();
g.drawText(plane.getName().replace("_", " " ), PLANE_NAME_FONT, Color.WHITE, textLeft, monitorBottom, w - 2 * textLeft, remainingHeight, false, HAlignment.CENTER, true); g.drawText(plane.getName().replace("_", " " ), PLANE_NAME_FONT, Color.WHITE, textLeft, monitorBottom, w - 2 * textLeft, remainingHeight, false, Align.center, true);
//draw left/right arrows //draw left/right arrows
float yMid = monitorBottom + remainingHeight / 2; float yMid = monitorBottom + remainingHeight / 2;

View File

@@ -1,7 +1,7 @@
package forge.screens.planarconquest; package forge.screens.planarconquest;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import forge.Forge; import forge.Forge;
import forge.Graphics; import forge.Graphics;
@@ -57,7 +57,7 @@ public class ConquestPlaneswalkScreen extends FScreen {
private PlaneswalkButton() { private PlaneswalkButton() {
super(new FLabel.Builder().font(FSkinFont.get(20)).parseSymbols().pressedColor(ConquestAEtherScreen.FILTER_BUTTON_PRESSED_COLOR) super(new FLabel.Builder().font(FSkinFont.get(20)).parseSymbols().pressedColor(ConquestAEtherScreen.FILTER_BUTTON_PRESSED_COLOR)
.textColor(ConquestAEtherScreen.FILTER_BUTTON_TEXT_COLOR).alphaComposite(1f).align(HAlignment.CENTER)); .textColor(ConquestAEtherScreen.FILTER_BUTTON_TEXT_COLOR).alphaComposite(1f).align(Align.center));
setCommand(new FEventHandler() { setCommand(new FEventHandler() {
@Override @Override
public void handleEvent(FEvent e) { public void handleEvent(FEvent e) {

View File

@@ -4,8 +4,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import forge.Graphics; import forge.Graphics;
import forge.ImageKeys; import forge.ImageKeys;
import forge.animation.ForgeAnimation; import forge.animation.ForgeAnimation;
@@ -281,7 +280,7 @@ public class ConquestRewardDialog extends FScrollPane {
if (reward.isDuplicate()) { if (reward.isDuplicate()) {
setFont(FSkinFont.get(20)); setFont(FSkinFont.get(20));
setIcon(FSkinImage.AETHER_SHARD); setIcon(FSkinImage.AETHER_SHARD);
setAlignment(HAlignment.CENTER); setAlignment(Align.center);
setText(String.valueOf(reward.getReplacementShards())); setText(String.valueOf(reward.getReplacementShards()));
} }
} }

View File

@@ -1,6 +1,6 @@
package forge.screens.planarconquest; package forge.screens.planarconquest;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import forge.assets.FImage; import forge.assets.FImage;
import forge.assets.FSkinFont; import forge.assets.FSkinFont;
@@ -57,7 +57,7 @@ public class ConquestStatsScreen extends FScreen implements IVConquestStats {
cbPlanes.addItem(plane); cbPlanes.addItem(plane);
} }
} }
cbPlanes.setAlignment(HAlignment.CENTER); cbPlanes.setAlignment(Align.center);
cbPlanes.setChangedHandler(new FEventHandler() { cbPlanes.setChangedHandler(new FEventHandler() {
@Override @Override
public void handleEvent(FEvent e) { public void handleEvent(FEvent e) {

View File

@@ -9,7 +9,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import forge.FThreads; import forge.FThreads;
import forge.Graphics; import forge.Graphics;
@@ -55,7 +55,7 @@ public class LoadConquestScreen extends LaunchScreen {
super(null, LoadGameMenu.getMenu()); super(null, LoadGameMenu.getMenu());
lblOldConquests.setFont(FSkinFont.get(12)); lblOldConquests.setFont(FSkinFont.get(12));
lblOldConquests.setAlignment(HAlignment.CENTER); lblOldConquests.setAlignment(Align.center);
btnNewConquest.setFont(FSkinFont.get(16)); btnNewConquest.setFont(FSkinFont.get(16));
btnNewConquest.setCommand(new FEventHandler() { btnNewConquest.setCommand(new FEventHandler() {
@@ -301,8 +301,8 @@ public class LoadConquestScreen extends LaunchScreen {
String progress = value.getProgress(); String progress = value.getProgress();
float winRatioWidth = font.getBounds(progress).width + SettingsScreen.SETTING_PADDING; float winRatioWidth = font.getBounds(progress).width + SettingsScreen.SETTING_PADDING;
g.drawText(name, font, foreColor, x, y, w - winRatioWidth, h, false, HAlignment.LEFT, false); g.drawText(name, font, foreColor, x, y, w - winRatioWidth, h, false, Align.left, false);
g.drawText(progress, font, foreColor, x, y, w, h, false, HAlignment.RIGHT, false); g.drawText(progress, font, foreColor, x, y, w, h, false, Align.right, false);
h += SettingsScreen.SETTING_PADDING; h += SettingsScreen.SETTING_PADDING;
y += h; y += h;
@@ -315,11 +315,11 @@ public class LoadConquestScreen extends LaunchScreen {
font = FSkinFont.get(12); font = FSkinFont.get(12);
float cardsWidth = font.getBounds(cards).width + iconSize + SettingsScreen.SETTING_PADDING; float cardsWidth = font.getBounds(cards).width + iconSize + SettingsScreen.SETTING_PADDING;
float shardsWidth = font.getBounds(shards).width + iconSize + SettingsScreen.SETTING_PADDING; float shardsWidth = font.getBounds(shards).width + iconSize + SettingsScreen.SETTING_PADDING;
g.drawText(value.getPlaneswalker().getName() + " - " + value.getCurrentPlane().getName().replace("_", " "), font, SettingsScreen.DESC_COLOR, x, y, w - shardsWidth - cardsWidth, h, false, HAlignment.LEFT, false); g.drawText(value.getPlaneswalker().getName() + " - " + value.getCurrentPlane().getName().replace("_", " "), font, SettingsScreen.DESC_COLOR, x, y, w - shardsWidth - cardsWidth, h, false, Align.left, false);
g.drawImage(FSkinImage.SPELLBOOK, x + w - shardsWidth - cardsWidth + iconOffset, y - SettingsScreen.SETTING_PADDING, iconSize, iconSize); g.drawImage(FSkinImage.SPELLBOOK, x + w - shardsWidth - cardsWidth + iconOffset, y - SettingsScreen.SETTING_PADDING, iconSize, iconSize);
g.drawText(cards, font, SettingsScreen.DESC_COLOR, x + w - shardsWidth - cardsWidth + iconSize + SettingsScreen.SETTING_PADDING, y, w, h, false, HAlignment.LEFT, false); g.drawText(cards, font, SettingsScreen.DESC_COLOR, x + w - shardsWidth - cardsWidth + iconSize + SettingsScreen.SETTING_PADDING, y, w, h, false, Align.left, false);
g.drawImage(FSkinImage.AETHER_SHARD, x + w - shardsWidth + iconOffset, y - SettingsScreen.SETTING_PADDING, iconSize, iconSize); g.drawImage(FSkinImage.AETHER_SHARD, x + w - shardsWidth + iconOffset, y - SettingsScreen.SETTING_PADDING, iconSize, iconSize);
g.drawText(shards, font, SettingsScreen.DESC_COLOR, x + w - shardsWidth + iconSize + SettingsScreen.SETTING_PADDING, y, w, h, false, HAlignment.LEFT, false); g.drawText(shards, font, SettingsScreen.DESC_COLOR, x + w - shardsWidth + iconSize + SettingsScreen.SETTING_PADDING, y, w, h, false, Align.left, false);
} }
}); });
} }

View File

@@ -11,8 +11,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import forge.FThreads; import forge.FThreads;
import forge.Forge; import forge.Forge;
import forge.Graphics; import forge.Graphics;
@@ -57,7 +56,7 @@ public class LoadQuestScreen extends LaunchScreen {
super(null, LoadGameMenu.getMenu()); super(null, LoadGameMenu.getMenu());
lblOldQuests.setFont(FSkinFont.get(12)); lblOldQuests.setFont(FSkinFont.get(12));
lblOldQuests.setAlignment(HAlignment.CENTER); lblOldQuests.setAlignment(Align.center);
btnNewQuest.setFont(FSkinFont.get(16)); btnNewQuest.setFont(FSkinFont.get(16));
btnNewQuest.setCommand(new FEventHandler() { btnNewQuest.setCommand(new FEventHandler() {
@@ -304,8 +303,8 @@ public class LoadQuestScreen extends LaunchScreen {
String winRatio = value.getAchievements().getWin() + "W / " + value.getAchievements().getLost() + "L"; String winRatio = value.getAchievements().getWin() + "W / " + value.getAchievements().getLost() + "L";
float winRatioWidth = font.getBounds(winRatio).width + SettingsScreen.SETTING_PADDING; float winRatioWidth = font.getBounds(winRatio).width + SettingsScreen.SETTING_PADDING;
g.drawText(name, font, foreColor, x, y, w - winRatioWidth, h, false, HAlignment.LEFT, false); g.drawText(name, font, foreColor, x, y, w - winRatioWidth, h, false, Align.left, false);
g.drawText(winRatio, font, foreColor, x, y, w, h, false, HAlignment.RIGHT, false); g.drawText(winRatio, font, foreColor, x, y, w, h, false, Align.right, false);
h += SettingsScreen.SETTING_PADDING; h += SettingsScreen.SETTING_PADDING;
y += h; y += h;
@@ -318,11 +317,11 @@ public class LoadQuestScreen extends LaunchScreen {
font = FSkinFont.get(12); font = FSkinFont.get(12);
float cardsWidth = font.getBounds(cards).width + iconSize + SettingsScreen.SETTING_PADDING; float cardsWidth = font.getBounds(cards).width + iconSize + SettingsScreen.SETTING_PADDING;
float creditsWidth = font.getBounds(credits).width + iconSize + SettingsScreen.SETTING_PADDING; float creditsWidth = font.getBounds(credits).width + iconSize + SettingsScreen.SETTING_PADDING;
g.drawText(FModel.getQuest().getRank(value.getAchievements().getLevel()), font, SettingsScreen.DESC_COLOR, x, y, w - creditsWidth - cardsWidth, h, false, HAlignment.LEFT, false); g.drawText(FModel.getQuest().getRank(value.getAchievements().getLevel()), font, SettingsScreen.DESC_COLOR, x, y, w - creditsWidth - cardsWidth, h, false, Align.left, false);
g.drawImage(FSkinImage.HAND, x + w - creditsWidth - cardsWidth + iconOffset, y - SettingsScreen.SETTING_PADDING, iconSize, iconSize); g.drawImage(FSkinImage.HAND, x + w - creditsWidth - cardsWidth + iconOffset, y - SettingsScreen.SETTING_PADDING, iconSize, iconSize);
g.drawText(cards, font, SettingsScreen.DESC_COLOR, x + w - creditsWidth - cardsWidth + iconSize + SettingsScreen.SETTING_PADDING, y, w, h, false, HAlignment.LEFT, false); g.drawText(cards, font, SettingsScreen.DESC_COLOR, x + w - creditsWidth - cardsWidth + iconSize + SettingsScreen.SETTING_PADDING, y, w, h, false, Align.left, false);
g.drawImage(FSkinImage.QUEST_COINSTACK, x + w - creditsWidth + iconOffset, y - SettingsScreen.SETTING_PADDING, iconSize, iconSize); g.drawImage(FSkinImage.QUEST_COINSTACK, x + w - creditsWidth + iconOffset, y - SettingsScreen.SETTING_PADDING, iconSize, iconSize);
g.drawText(credits, font, SettingsScreen.DESC_COLOR, x + w - creditsWidth + iconSize + SettingsScreen.SETTING_PADDING, y, w, h, false, HAlignment.LEFT, false); g.drawText(credits, font, SettingsScreen.DESC_COLOR, x + w - creditsWidth + iconSize + SettingsScreen.SETTING_PADDING, y, w, h, false, Align.left, false);
} }
}); });
} }

View File

@@ -1,6 +1,6 @@
package forge.screens.quest; package forge.screens.quest;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import forge.FThreads; import forge.FThreads;
import forge.Forge; import forge.Forge;
@@ -95,7 +95,7 @@ public class NewQuestScreen extends FScreen {
obj.setBounds(x, y, visibleWidth / 2 - x, h); //make label take up half of line so combo boxes all the same width obj.setBounds(x, y, visibleWidth / 2 - x, h); //make label take up half of line so combo boxes all the same width
x += obj.getWidth(); x += obj.getWidth();
continue; continue;
} else if (lbl.getAlignment() == HAlignment.RIGHT) { } else if (lbl.getAlignment() == Align.right) {
y -= gapY; //remove most of the padding above description text y -= gapY; //remove most of the padding above description text
} }
} }
@@ -121,7 +121,7 @@ public class NewQuestScreen extends FScreen {
private final FLabel lblStartingPool = scroller.add(new FLabel.Builder().text("Starting pool:").build()); private final FLabel lblStartingPool = scroller.add(new FLabel.Builder().text("Starting pool:").build());
private final FComboBox<StartingPoolType> cbxStartingPool = scroller.add(new FComboBox<StartingPoolType>()); private final FComboBox<StartingPoolType> cbxStartingPool = scroller.add(new FComboBox<StartingPoolType>());
private final FLabel lblUnrestricted = scroller.add(new FLabel.Builder().align(HAlignment.RIGHT).font(FSkinFont.get(12)).text("All cards will be available to play.").build()); private final FLabel lblUnrestricted = scroller.add(new FLabel.Builder().align(Align.right).font(FSkinFont.get(12)).text("All cards will be available to play.").build());
private final FLabel lblPreconDeck = scroller.add(new FLabel.Builder().text("Starter/Event deck:").build()); private final FLabel lblPreconDeck = scroller.add(new FLabel.Builder().text("Starter/Event deck:").build());
private final FComboBox<String> cbxPreconDeck = scroller.add(new FComboBox<String>()); private final FComboBox<String> cbxPreconDeck = scroller.add(new FComboBox<String>());
@@ -161,8 +161,8 @@ public class NewQuestScreen extends FScreen {
private final FLabel lblPrizeFormat = scroller.add(new FLabel.Builder().text("Defined format:").build()); private final FLabel lblPrizeFormat = scroller.add(new FLabel.Builder().text("Defined format:").build());
private final FComboBox<GameFormat> cbxPrizeFormat = scroller.add(new FComboBox<GameFormat>()); private final FComboBox<GameFormat> cbxPrizeFormat = scroller.add(new FComboBox<GameFormat>());
private final FLabel lblPrizeUnrestricted = scroller.add(new FLabel.Builder().align(HAlignment.RIGHT).font(FSkinFont.get(12)).text("All cards will be available to win.").build()); private final FLabel lblPrizeUnrestricted = scroller.add(new FLabel.Builder().align(Align.right).font(FSkinFont.get(12)).text("All cards will be available to win.").build());
private final FLabel lblPrizeSameAsStarting = scroller.add(new FLabel.Builder().align(HAlignment.RIGHT).font(FSkinFont.get(12)).text("Only sets found in starting pool will be available.").build()); private final FLabel lblPrizeSameAsStarting = scroller.add(new FLabel.Builder().align(Align.right).font(FSkinFont.get(12)).text("Only sets found in starting pool will be available.").build());
private final FLabel btnPrizeSelectFormat = scroller.add(new FLabel.ButtonBuilder().text("Choose format").build()); private final FLabel btnPrizeSelectFormat = scroller.add(new FLabel.ButtonBuilder().text("Choose format").build());
private final FCheckBox cbAllowUnlocks = scroller.add(new FCheckBox("Allow unlock of additional editions")); private final FCheckBox cbAllowUnlocks = scroller.add(new FCheckBox("Allow unlock of additional editions"));

View File

@@ -3,8 +3,8 @@ package forge.screens.quest;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Align;
import forge.Forge; import forge.Forge;
import forge.Graphics; import forge.Graphics;
@@ -56,12 +56,12 @@ public class QuestBazaarScreen extends TabPageScreen<QuestBazaarScreen> {
private static final float PADDING = Utils.scale(5); private static final float PADDING = Utils.scale(5);
private final QuestStallDefinition stallDef; private final QuestStallDefinition stallDef;
private final FLabel lblStallName = add(new FLabel.Builder().text("").align(HAlignment.CENTER).build()); private final FLabel lblStallName = add(new FLabel.Builder().text("").align(Align.center).build());
private final FLabel lblEmpty = add(new FLabel.Builder().font(FSkinFont.get(12)) private final FLabel lblEmpty = add(new FLabel.Builder().font(FSkinFont.get(12))
.text("The merchant does not have anything useful for sale.") .text("The merchant does not have anything useful for sale.")
.align(HAlignment.CENTER).build()); .align(Align.center).build());
private final FLabel lblCredits = add(new FLabel.Builder().font(FSkinFont.get(15)).icon(FSkinImage.QUEST_COINSTACK).iconScaleFactor(1f).build()); private final FLabel lblCredits = add(new FLabel.Builder().font(FSkinFont.get(15)).icon(FSkinImage.QUEST_COINSTACK).iconScaleFactor(1f).build());
private final FLabel lblLife = add(new FLabel.Builder().font(lblCredits.getFont()).icon(FSkinImage.QUEST_LIFE).iconScaleFactor(1f).align(HAlignment.RIGHT).build()); private final FLabel lblLife = add(new FLabel.Builder().font(lblCredits.getFont()).icon(FSkinImage.QUEST_LIFE).iconScaleFactor(1f).align(Align.right).build());
private final FTextArea lblFluff = add(new FTextArea(false)); private final FTextArea lblFluff = add(new FTextArea(false));
private final FScrollPane scroller = add(new FScrollPane() { private final FScrollPane scroller = add(new FScrollPane() {
@Override @Override
@@ -87,7 +87,7 @@ public class QuestBazaarScreen extends TabPageScreen<QuestBazaarScreen> {
stallDef = stallDef0; stallDef = stallDef0;
lblFluff.setFont(FSkinFont.get(12)); lblFluff.setFont(FSkinFont.get(12));
lblFluff.setAlignment(HAlignment.CENTER); lblFluff.setAlignment(Align.center);
lblFluff.setTextColor(FLabel.INLINE_LABEL_COLOR); //make fluff text a little lighter lblFluff.setTextColor(FLabel.INLINE_LABEL_COLOR); //make fluff text a little lighter
} }

View File

@@ -1,7 +1,7 @@
package forge.screens.quest; package forge.screens.quest;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Align;
import forge.assets.FSkinFont; import forge.assets.FSkinFont;
import forge.interfaces.IButton; import forge.interfaces.IButton;
@@ -10,14 +10,14 @@ import forge.toolbox.FLabel;
public class QuestChallengesScreen extends QuestLaunchScreen { public class QuestChallengesScreen extends QuestLaunchScreen {
private final FLabel lblInfo = add(new FLabel.Builder().text("Which challenge will you attempt?") private final FLabel lblInfo = add(new FLabel.Builder().text("Which challenge will you attempt?")
.align(HAlignment.CENTER).font(FSkinFont.get(16)).build()); .align(Align.center).font(FSkinFont.get(16)).build());
private final FLabel lblCurrentDeck = add(new FLabel.Builder() private final FLabel lblCurrentDeck = add(new FLabel.Builder()
.text("Current deck hasn't been set yet.").align(HAlignment.CENTER).insets(Vector2.Zero) .text("Current deck hasn't been set yet.").align(Align.center).insets(Vector2.Zero)
.font(FSkinFont.get(12)).build()); .font(FSkinFont.get(12)).build());
private final FLabel lblNextChallengeInWins = add(new FLabel.Builder() private final FLabel lblNextChallengeInWins = add(new FLabel.Builder()
.text("Next challenge in wins hasn't been set yet.").align(HAlignment.CENTER).insets(Vector2.Zero) .text("Next challenge in wins hasn't been set yet.").align(Align.center).insets(Vector2.Zero)
.font(FSkinFont.get(12)).build()); .font(FSkinFont.get(12)).build());
private final QuestEventPanel.Container pnlChallenges = add(new QuestEventPanel.Container()); private final QuestEventPanel.Container pnlChallenges = add(new QuestEventPanel.Container());

View File

@@ -1,7 +1,6 @@
package forge.screens.quest; package forge.screens.quest;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import forge.FThreads; import forge.FThreads;
import forge.Forge; import forge.Forge;
import forge.assets.FSkinFont; import forge.assets.FSkinFont;
@@ -34,7 +33,7 @@ public class QuestDecksScreen extends FScreen {
private final FButton btnRandom = add(new FButton("Random Deck")); private final FButton btnRandom = add(new FButton("Random Deck"));
private final FLabel lblInfo = add(new FLabel.Builder() private final FLabel lblInfo = add(new FLabel.Builder()
.align(HAlignment.CENTER).font(FSkinFont.get(16)) .align(Align.center).font(FSkinFont.get(16))
.text("Build or select a deck").build()); .text("Build or select a deck").build());
private final FEventHandler onDeckSelectionChanged = new FEventHandler() { private final FEventHandler onDeckSelectionChanged = new FEventHandler() {

View File

@@ -1,7 +1,7 @@
package forge.screens.quest; package forge.screens.quest;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Align;
import forge.assets.FSkinFont; import forge.assets.FSkinFont;
import forge.interfaces.IButton; import forge.interfaces.IButton;
import forge.model.FModel; import forge.model.FModel;
@@ -15,14 +15,14 @@ import java.util.List;
public class QuestDuelsScreen extends QuestLaunchScreen { public class QuestDuelsScreen extends QuestLaunchScreen {
private final FLabel lblInfo = add(new FLabel.Builder().text("Select your next duel.") private final FLabel lblInfo = add(new FLabel.Builder().text("Select your next duel.")
.align(HAlignment.CENTER).font(FSkinFont.get(16)).build()); .align(Align.center).font(FSkinFont.get(16)).build());
private final FLabel lblCurrentDeck = add(new FLabel.Builder() private final FLabel lblCurrentDeck = add(new FLabel.Builder()
.text("Current deck hasn't been set yet.").align(HAlignment.CENTER).insets(Vector2.Zero) .text("Current deck hasn't been set yet.").align(Align.center).insets(Vector2.Zero)
.font(FSkinFont.get(12)).build()); .font(FSkinFont.get(12)).build());
private final FLabel lblNextChallengeInWins = add(new FLabel.Builder() private final FLabel lblNextChallengeInWins = add(new FLabel.Builder()
.text("Next challenge in wins hasn't been set yet.").align(HAlignment.CENTER).insets(Vector2.Zero) .text("Next challenge in wins hasn't been set yet.").align(Align.center).insets(Vector2.Zero)
.font(FSkinFont.get(12)).build()); .font(FSkinFont.get(12)).build());
private final QuestEventPanel.Container pnlDuels = add(new QuestEventPanel.Container()); private final QuestEventPanel.Container pnlDuels = add(new QuestEventPanel.Container());

View File

@@ -1,7 +1,7 @@
package forge.screens.quest; package forge.screens.quest;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import forge.Graphics; import forge.Graphics;
import forge.assets.*; import forge.assets.*;
import forge.assets.FSkinColor.Colors; import forge.assets.FSkinColor.Colors;
@@ -109,11 +109,11 @@ class QuestEventPanel extends FDisplayObject {
//draw title //draw title
w -= x + 2 * (RADIO_BUTTON_RADIUS + PADDING); w -= x + 2 * (RADIO_BUTTON_RADIUS + PADDING);
String title = event.getFullTitle(); String title = event.getFullTitle();
g.drawText(title, TITLE_FONT, TITLE_COLOR, x, y, w, h, false, HAlignment.LEFT, false); g.drawText(title, TITLE_FONT, TITLE_COLOR, x, y, w, h, false, Align.left, false);
//draw description //draw description
y += TITLE_FONT.getCapHeight() + 2 * PADDING; y += TITLE_FONT.getCapHeight() + 2 * PADDING;
g.drawText(event.getDescription(), DESC_FONT, DESC_COLOR, x, y, w, h - PADDING - y, true, HAlignment.LEFT, false); g.drawText(event.getDescription(), DESC_FONT, DESC_COLOR, x, y, w, h - PADDING - y, true, Align.left, false);
//draw radio button //draw radio button
x = getWidth() - PADDING - RADIO_BUTTON_RADIUS; x = getWidth() - PADDING - RADIO_BUTTON_RADIUS;

View File

@@ -6,7 +6,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import forge.FThreads; import forge.FThreads;
import forge.assets.FImage; import forge.assets.FImage;
@@ -315,7 +315,7 @@ public class QuestSpellShopScreen extends TabPageScreen<QuestSpellShopScreen> {
private static class InventoryPage extends SpellShopBasePage { private static class InventoryPage extends SpellShopBasePage {
protected FLabel lblSellExtras = add(new FLabel.Builder().text("Sell all extras") protected FLabel lblSellExtras = add(new FLabel.Builder().text("Sell all extras")
.icon(FSkinImage.MINUS).iconScaleFactor(1f).align(HAlignment.RIGHT).font(FSkinFont.get(16)) .icon(FSkinImage.MINUS).iconScaleFactor(1f).align(Align.right).font(FSkinFont.get(16))
.command(new FEventHandler() { .command(new FEventHandler() {
@Override @Override
public void handleEvent(FEvent e) { public void handleEvent(FEvent e) {

View File

@@ -1,7 +1,7 @@
package forge.screens.quest; package forge.screens.quest;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Align;
import forge.FThreads; import forge.FThreads;
import forge.Forge; import forge.Forge;
@@ -45,10 +45,10 @@ public class QuestTournamentsScreen extends QuestLaunchScreen implements IQuestT
private final FLabel btnSpendToken = pnlSelectTournament.add(new FLabel.ButtonBuilder().text("Spend Token (0)").build()); private final FLabel btnSpendToken = pnlSelectTournament.add(new FLabel.ButtonBuilder().text("Spend Token (0)").build());
private final FLabel lblInfo = pnlSelectTournament.add(new FLabel.Builder().text("Select a tournament to join:") private final FLabel lblInfo = pnlSelectTournament.add(new FLabel.Builder().text("Select a tournament to join:")
.align(HAlignment.CENTER).font(FSkinFont.get(16)).build()); .align(Align.center).font(FSkinFont.get(16)).build());
private final FLabel lblNoTournaments = pnlSelectTournament.add(new FLabel.Builder() private final FLabel lblNoTournaments = pnlSelectTournament.add(new FLabel.Builder()
.align(HAlignment.CENTER).text("There are no tournaments available at this time.").insets(Vector2.Zero) .align(Align.center).text("There are no tournaments available at this time.").insets(Vector2.Zero)
.font(FSkinFont.get(12)).build()); .font(FSkinFont.get(12)).build());
private final QuestEventPanel.Container pnlTournaments = pnlSelectTournament.add(new QuestEventPanel.Container()); private final QuestEventPanel.Container pnlTournaments = pnlSelectTournament.add(new QuestEventPanel.Container());
@@ -372,7 +372,7 @@ public class QuestTournamentsScreen extends QuestLaunchScreen implements IQuestT
int[] iconIDs = new int[16]; int[] iconIDs = new int[16];
String draftTitle = qd.getFullTitle(); String draftTitle = qd.getFullTitle();
FLabel lblStandings = add(new FLabel.Builder().text("Draft: " + draftTitle).align(HAlignment.CENTER).font(FSkinFont.get(20)).build()); FLabel lblStandings = add(new FLabel.Builder().text("Draft: " + draftTitle).align(Align.center).font(FSkinFont.get(20)).build());
lblStandings.setBounds(x, y, w, lblStandings.getAutoSizeBounds().height); lblStandings.setBounds(x, y, w, lblStandings.getAutoSizeBounds().height);
y += lblStandings.getHeight() + PADDING; y += lblStandings.getHeight() + PADDING;
@@ -385,7 +385,7 @@ public class QuestTournamentsScreen extends QuestLaunchScreen implements IQuestT
String sid = qd.getStandings()[qd.getStandings().length - 1]; String sid = qd.getStandings()[qd.getStandings().length - 1];
String winnersName = sid.equals(QuestEventDraft.HUMAN) ? FModel.getPreferences().getPref(FPref.PLAYER_NAME) : String winnersName = sid.equals(QuestEventDraft.HUMAN) ? FModel.getPreferences().getPref(FPref.PLAYER_NAME) :
sid.equals(QuestEventDraft.UNDETERMINED) ? "---" : qd.getAINames()[Integer.parseInt(sid) - 1]; sid.equals(QuestEventDraft.UNDETERMINED) ? "---" : qd.getAINames()[Integer.parseInt(sid) - 1];
FLabel lblWinner = add(new FLabel.Builder().text("Winner: " + winnersName).align(HAlignment.CENTER).font(FSkinFont.get(20)).build()); FLabel lblWinner = add(new FLabel.Builder().text("Winner: " + winnersName).align(Align.center).font(FSkinFont.get(20)).build());
lblWinner.setBounds(x, y, w, lblStandings.getAutoSizeBounds().height); lblWinner.setBounds(x, y, w, lblStandings.getAutoSizeBounds().height);
y += lblWinner.getHeight() + PADDING; y += lblWinner.getHeight() + PADDING;
getBtnLeaveTournamentInTourn().setText("Collect Prizes"); getBtnLeaveTournamentInTourn().setText("Collect Prizes");
@@ -427,17 +427,17 @@ public class QuestTournamentsScreen extends QuestLaunchScreen implements IQuestT
for (int j = 0; j < 13; j += 2) { for (int j = 0; j < 13; j += 2) {
switch (j) { switch (j) {
case 0: case 0:
FLabel qfinals = add(new FLabel.Builder().text("QUARTERFINALS").align(HAlignment.CENTER).font(FSkinFont.get(16)).build()); FLabel qfinals = add(new FLabel.Builder().text("QUARTERFINALS").align(Align.center).font(FSkinFont.get(16)).build());
qfinals.setBounds(x, y, w, qfinals.getAutoSizeBounds().height); qfinals.setBounds(x, y, w, qfinals.getAutoSizeBounds().height);
y += qfinals.getHeight() + PADDING; y += qfinals.getHeight() + PADDING;
break; break;
case 8: case 8:
FLabel sfinals = add(new FLabel.Builder().text("SEMIFINALS").align(HAlignment.CENTER).font(FSkinFont.get(16)).build()); FLabel sfinals = add(new FLabel.Builder().text("SEMIFINALS").align(Align.center).font(FSkinFont.get(16)).build());
sfinals.setBounds(x, y, w, sfinals.getAutoSizeBounds().height); sfinals.setBounds(x, y, w, sfinals.getAutoSizeBounds().height);
y += sfinals.getHeight() + PADDING; y += sfinals.getHeight() + PADDING;
break; break;
case 12: case 12:
FLabel finals = add(new FLabel.Builder().text("FINAL MATCH").align(HAlignment.CENTER).font(FSkinFont.get(16)).build()); FLabel finals = add(new FLabel.Builder().text("FINAL MATCH").align(Align.center).font(FSkinFont.get(16)).build());
finals.setBounds(x, y, w, finals.getAutoSizeBounds().height); finals.setBounds(x, y, w, finals.getAutoSizeBounds().height);
y += finals.getHeight() + PADDING; y += finals.getHeight() + PADDING;
break; break;
@@ -453,7 +453,7 @@ public class QuestTournamentsScreen extends QuestLaunchScreen implements IQuestT
FTextureRegionImage avatar1 = new FTextureRegionImage(FSkin.getAvatars().get(iconIDs[j])); FTextureRegionImage avatar1 = new FTextureRegionImage(FSkin.getAvatars().get(iconIDs[j]));
FTextureRegionImage avatar2 = new FTextureRegionImage(FSkin.getAvatars().get(iconIDs[j+1])); FTextureRegionImage avatar2 = new FTextureRegionImage(FSkin.getAvatars().get(iconIDs[j+1]));
*/ */
labels[j] = add(new FLabel.Builder().icon(currentMatch ? FSkinImage.STAR_FILLED : FSkinImage.STAR_OUTINE).text(labelText).align(HAlignment.CENTER).font(FSkinFont.get(16)).build()); labels[j] = add(new FLabel.Builder().icon(currentMatch ? FSkinImage.STAR_FILLED : FSkinImage.STAR_OUTINE).text(labelText).align(Align.center).font(FSkinFont.get(16)).build());
labels[j].setBounds(x, y, w, labels[j].getAutoSizeBounds().height); labels[j].setBounds(x, y, w, labels[j].getAutoSizeBounds().height);
if (currentMatch) { if (currentMatch) {
labels[j].setTextColor(FSkinColor.get(FSkinColor.Colors.CLR_ACTIVE)); labels[j].setTextColor(FSkinColor.get(FSkinColor.Colors.CLR_ACTIVE));

View File

@@ -3,7 +3,7 @@ package forge.screens.settings;
import forge.download.*; import forge.download.*;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import forge.Graphics; import forge.Graphics;
import forge.assets.FSkinColor; import forge.assets.FSkinColor;
@@ -142,9 +142,9 @@ public class FilesPage extends TabPage<SettingsScreen> {
float totalHeight = h; float totalHeight = h;
h = font.getMultiLineBounds(value.label).height + SettingsScreen.SETTING_PADDING; h = font.getMultiLineBounds(value.label).height + SettingsScreen.SETTING_PADDING;
g.drawText(value.label, font, foreColor, x, y, w, h, false, HAlignment.LEFT, false); g.drawText(value.label, font, foreColor, x, y, w, h, false, Align.left, false);
h += SettingsScreen.SETTING_PADDING; h += SettingsScreen.SETTING_PADDING;
g.drawText(value.description, SettingsScreen.DESC_FONT, SettingsScreen.DESC_COLOR, x, y + h, w, totalHeight - h + SettingsScreen.getInsets(w), true, HAlignment.LEFT, false); g.drawText(value.description, SettingsScreen.DESC_FONT, SettingsScreen.DESC_COLOR, x, y + h, w, totalHeight - h + SettingsScreen.getInsets(w), true, Align.left, false);
} }
} }

View File

@@ -1,6 +1,6 @@
package forge.screens.settings; package forge.screens.settings;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.utils.Align;
import forge.Forge; import forge.Forge;
import forge.Graphics; import forge.Graphics;
import forge.MulliganDefs; import forge.MulliganDefs;
@@ -456,7 +456,7 @@ public class SettingsPage extends TabPage<SettingsScreen> {
w -= 2 * offset; w -= 2 * offset;
h -= 2 * offset; h -= 2 * offset;
g.drawText(value, font, foreColor, x, y, w, h, false, HAlignment.LEFT, true); g.drawText(value, font, foreColor, x, y, w, h, false, Align.left, true);
float radius = h / 3; float radius = h / 3;
x += w - radius; x += w - radius;
@@ -485,7 +485,7 @@ public class SettingsPage extends TabPage<SettingsScreen> {
@Override @Override
public void drawPrefValue(Graphics g, FSkinFont font, FSkinColor color, float x, float y, float w, float h) { public void drawPrefValue(Graphics g, FSkinFont font, FSkinColor color, float x, float y, float w, float h) {
g.drawText(FModel.getPreferences().getPref(pref), font, color, x, y, w, h, false, HAlignment.RIGHT, false); g.drawText(FModel.getPreferences().getPref(pref), font, color, x, y, w, h, false, Align.right, false);
} }
} }
@@ -512,10 +512,10 @@ public class SettingsPage extends TabPage<SettingsScreen> {
float totalHeight = h; float totalHeight = h;
h = font.getMultiLineBounds(value.label).height + SettingsScreen.SETTING_PADDING; h = font.getMultiLineBounds(value.label).height + SettingsScreen.SETTING_PADDING;
g.drawText(value.label, font, foreColor, x, y, w, h, false, HAlignment.LEFT, false); g.drawText(value.label, font, foreColor, x, y, w, h, false, Align.left, false);
value.drawPrefValue(g, font, foreColor, x, y, w, h); value.drawPrefValue(g, font, foreColor, x, y, w, h);
h += SettingsScreen.SETTING_PADDING; h += SettingsScreen.SETTING_PADDING;
g.drawText(value.description, SettingsScreen.DESC_FONT, SettingsScreen.DESC_COLOR, x, y + h, w, totalHeight - h + SettingsScreen.getInsets(w), true, HAlignment.LEFT, false); g.drawText(value.description, SettingsScreen.DESC_FONT, SettingsScreen.DESC_COLOR, x, y + h, w, totalHeight - h + SettingsScreen.getInsets(w), true, Align.left, false);
} }
} }
} }

Some files were not shown because too many files have changed in this diff Show More