The desktop libgdx gui version now boots up. (It cannot load the resources, so it just throws an exception, and shows the loading screen.)

This commit is contained in:
Relintai 2017-10-06 22:23:02 +02:00
parent 8dfa917ed1
commit 493acbacc4
95 changed files with 625 additions and 325 deletions

View File

@ -117,16 +117,15 @@ project(":forge-gui-mobile") {
project(":forge-gui-mobile-desktop") {
apply plugin: "java"
dependencies {
compile project(":forge-core")
compile project(":forge-game")
compile project(":forge-ai")
compile project(":forge-gui")
compile project(":forge-gui-mobile")
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
compile "com.miglayout:miglayout:3.5.5"
compile "com.mortennobel:java-image-scaling:0.8.5"
compile "org.freemarker:freemarker:2.3.20"

View File

@ -1,10 +1,10 @@
apply plugin: "java"
sourceCompatibility = 1.7
sourceSets.main.java.srcDirs = [ "src/main/java/forge/" ]
sourceSets.main.java.srcDirs = [ "src/" ]
project.ext.mainClassName = "forge.view.Main"
project.ext.assetsDir = new File("src");
project.ext.assetsDir = new File("../forge-gui/res");
task run(dependsOn: classes, type: JavaExec) {

View File

@ -1,7 +1,7 @@
apply plugin: "java"
sourceCompatibility = 1.7
sourceSets.main.java.srcDirs = [ "src/forge/" ]
sourceSets.main.java.srcDirs = [ "src" ]
project.ext.mainClassName = "forge.app.Main"
project.ext.assetsDir = new File("assets");

View File

@ -1,12 +0,0 @@
package com.mygdx.game.desktop;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.mygdx.game.MyGdxGame;
public class DesktopLauncher {
public static void main (String[] arg) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
new LwjglApplication(new MyGdxGame(), config);
}
}

View File

@ -1,14 +0,0 @@
package forge.app;
import android.app.Activity;
import android.os.Bundle;
public class Exiter extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
finish();
//ensure process fully killed
System.exit(0);
}
}

View File

@ -1,13 +0,0 @@
package forge.app;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import forge.Forge;
public class Main {
public static void main (String[] arg) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
new LwjglApplication(new Forge(), config);
}
}
}

View File

@ -0,0 +1,181 @@
package forge.app;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.badlogic.gdx.backends.lwjgl.LwjglClipboard;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.g3d.Environment;
import forge.Forge;
import forge.interfaces.IDeviceAdapter;
public class Main {
public static void main (String[] arg) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
// FileHandle fg = Gdx.files.local("Forge/");
// if (!fg.exists()) {
// fg.mkdirs();
// }
System.out.println(System.getProperty("user.dir"));
new LwjglApplication(Forge.getApp(new LwjglClipboard(), new LwjglAdapter(), System.getProperty("user.dir") + "/"), config);
}
private static class LwjglAdapter implements IDeviceAdapter {
private LwjglAdapter() {
}
@Override
public boolean isConnectedToInternet() {
return true;
//return Boolean.TRUE.equals(ThreadUtil.executeWithTimeout(new Callable<Boolean>() {
// @Override
// public Boolean call() throws Exception {
// NetworkInfo activeNetworkInfo = connManager.getActiveNetworkInfo();
// return activeNetworkInfo != null && activeNetworkInfo.isConnected();
// }
// }, 2000)); //if can't determine Internet connection within two seconds, assume not connected
}
@Override
public boolean isConnectedToWifi() {
return true;
// return Boolean.TRUE.equals(ThreadUtil.executeWithTimeout(new Callable<Boolean>() {
// @Override
// public Boolean call() throws Exception {
// NetworkInfo wifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
// return wifi.isConnected();
// }
// }, 2000)); //if can't determine Internet connection within two seconds, assume not connected
}
@Override
public String getDownloadsDir() {
return Gdx.files.getLocalStoragePath() + "/downloads";
// return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "/";
}
@Override
public boolean openFile(String filename) {
FileHandle fh = Gdx.files.absolute(filename);
return fh.exists();
/*
try {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //ensure this task isn't linked to this application
Uri uri = Uri.fromFile(new File(filename));
String type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(
MimeTypeMap.getFileExtensionFromUrl(uri.toString()));
intent.setDataAndType(uri, type);
startActivity(intent);
return true;
}
catch (Exception e) {
e.printStackTrace();
}
return false;
*/
}
@Override
public void restart() {
/*
try { //solution from http://stackoverflow.com/questions/6609414/howto-programatically-restart-android-app
Context c = getApplicationContext();
PackageManager pm = c.getPackageManager();
if (pm != null) {
//create the intent with the default start activity for your application
Intent mStartActivity = pm.getLaunchIntentForPackage(c.getPackageName());
if (mStartActivity != null) {
mStartActivity.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
//create a pending intent so the application is restarted after System.exit(0) was called.
// We use an AlarmManager to call this intent in 100ms
int mPendingIntentId = 223344;
PendingIntent mPendingIntent = PendingIntent.getActivity(c, mPendingIntentId, mStartActivity, PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager mgr = (AlarmManager) c.getSystemService(Context.ALARM_SERVICE);
mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 100, mPendingIntent);
//kill the application
System.exit(0);
}
}
}
catch (Exception e) {
e.printStackTrace();
}
*/
}
@Override
public void exit() {
/*
// Replace the current task with one that is excluded from the recent
// apps and that will finish itself immediately. It's critical that this
// activity get launched in the task that you want to hide.
final Intent relaunch = new Intent(getApplicationContext(), Exiter.class)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK // CLEAR_TASK requires this
| Intent.FLAG_ACTIVITY_CLEAR_TASK // finish everything else in the task
| Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); // hide (remove, in this case) task from recents
startActivity(relaunch);
*/
}
@Override
public boolean isTablet() {
return false;
}
@Override
public void setLandscapeMode(boolean landscapeMode) {
/*
//create file to indicate that portrait mode should be used for tablet or landscape should be used for phone
if (landscapeMode != isTablet) {
FileUtil.writeFile(switchOrientationFile, "1");
}
else {
FileUtil.deleteFile(switchOrientationFile);
}
*/
}
@Override
public void preventSystemSleep(final boolean preventSleep) {
/*
FThreads.invokeInEdtNowOrLater(new Runnable() { //must set window flags from EDT thread
@Override
public void run() {
if (preventSleep) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
else {
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
}
});
*/
}
}
}

View File

@ -3,7 +3,7 @@ apply plugin: "java"
sourceCompatibility = 1.7
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
sourceSets.main.java.srcDirs = [ "src/forge/" ]
sourceSets.main.java.srcDirs = [ "src" ]
eclipse.project {

View File

@ -0,0 +1,2 @@
Manifest-Version: 1.0

View File

@ -14,10 +14,13 @@ import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.scenes.scene2d.utils.ScissorStack;
import com.badlogic.gdx.utils.Align;
import forge.assets.FImage;
import forge.assets.FSkinColor;
import forge.assets.FSkinFont;
import forge.toolbox.FDisplayObject;
import forge.toolbox.TextBounds;
import forge.util.Utils;
import java.util.Stack;
@ -601,10 +604,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);
}
public void drawText(String text, FSkinFont font, FSkinColor skinColor, float x, float y, float w, float h, boolean wrap, HAlignment horzAlignment, boolean centerVertically) {
drawText(text, font, skinColor.getColor(), x, y, w, h, wrap, horzAlignment, centerVertically);
public void drawText(String text, FSkinFont font, FSkinColor skinColor, float x, float y, float w, float h, boolean wrap, int alignment, boolean centerVertically) {
drawText(text, font, skinColor.getColor(), x, y, w, h, wrap, alignment, 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 alignment, boolean centerVertically) {
if (alphaComposite < 1) {
color = FSkinColor.alphaColor(color, color.a * alphaComposite);
}
@ -647,7 +650,7 @@ public class Graphics {
y += (h - textHeight) / 2;
}
font.draw(batch, text, color, adjustX(x), adjustY(y, 0), w, wrap, horzAlignment);
font.draw(batch, text, color, adjustX(x), adjustY(y, 0), w, wrap, alignment);
if (needClip) {
endClip();
@ -659,14 +662,14 @@ public class Graphics {
}
//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) {
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 - 1, y - 1, 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 + 1, y + 1, w, h, wrap, horzAlignment, centerVertically);
drawText(text, skinFont, textColor, x, y, w, h, wrap, horzAlignment, centerVertically);
public void drawOutlinedText(String text, FSkinFont skinFont, Color textColor, Color outlineColor, float x, float y, float w, float h, boolean wrap, int halign, boolean centerVertically) {
drawText(text, skinFont, outlineColor, x - 1, y, w, h, wrap, halign, centerVertically);
drawText(text, skinFont, outlineColor, x, y - 1, w, h, wrap, halign, centerVertically);
drawText(text, skinFont, outlineColor, x - 1, y - 1, w, h, wrap, halign, centerVertically);
drawText(text, skinFont, outlineColor, x + 1, y, w, h, wrap, halign, centerVertically);
drawText(text, skinFont, outlineColor, x, y + 1, w, h, wrap, halign, centerVertically);
drawText(text, skinFont, outlineColor, x + 1, y + 1, w, h, wrap, halign, centerVertically);
drawText(text, skinFont, textColor, x, y, w, h, wrap, halign, centerVertically);
}
public float adjustX(float x) {

View File

@ -8,12 +8,12 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion;
import forge.Graphics;
public class GifAnimation extends ForgeAnimation {
private final Animation animation;
private final Animation<TextureRegion> animation;
private TextureRegion currentFrame;
private float stateTime;
public GifAnimation(String filename) {
animation = GifDecoder.loadGIFAnimation(PlayMode.NORMAL, Gdx.files.absolute(filename).read());
animation = (Animation<TextureRegion>) GifDecoder.loadGIFAnimation(PlayMode.NORMAL, Gdx.files.absolute(filename).read());
}
@Override

View File

@ -7,19 +7,21 @@ import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
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.BitmapFont;
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
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.FreeTypeFontParameter;
import com.badlogic.gdx.graphics.glutils.PixmapTextureData;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.Array;
import forge.FThreads;
import forge.properties.ForgeConstants;
import forge.util.FileUtil;
import forge.util.Utils;
import forge.toolbox.TextBounds;
import java.io.File;
import java.util.HashMap;
@ -80,6 +82,8 @@ public class FSkinFont {
private final int fontSize;
private final float scale;
private BitmapFont font;
private GlyphLayout glyphLayout = new GlyphLayout();
private TextBounds textBounds = new TextBounds();
private FSkinFont(int fontSize0) {
if (fontSize0 > MAX_FONT_SIZE) {
@ -98,15 +102,34 @@ public class FSkinFont {
// Expose methods from font that updates scale as needed
public TextBounds getBounds(CharSequence str) {
updateScale(); //must update scale before measuring text
return font.getBounds(str);
glyphLayout.setText(font, str);
textBounds.set(glyphLayout);
return textBounds;
}
public TextBounds getMultiLineBounds(CharSequence str) {
updateScale();
return font.getMultiLineBounds(str);
glyphLayout.setText(font, str);
textBounds.set(glyphLayout);
return textBounds;
//return font.getMultiLineBounds(str);
}
public TextBounds getWrappedBounds(CharSequence str, float wrapWidth) {
updateScale();
return font.getWrappedBounds(str, wrapWidth);
glyphLayout.setText(font, str, Color.WHITE, wrapWidth, Align.topLeft, true);
textBounds.set(glyphLayout);
return textBounds;
//return font.getWrappedBounds(str, wrapWidth);
}
public float getAscent() {
updateScale();
@ -121,20 +144,17 @@ public class FSkinFont {
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 alignment) {
updateScale();
font.setColor(color);
if (wrap) {
font.drawWrapped(batch, text, x, y, w, horzAlignment);
} else {
font.drawMultiLine(batch, text, x, y, w, horzAlignment);
}
font.draw(batch, text, x, y, w, alignment, wrap);
}
//update scale of font if needed
private void updateScale() {
if (font.getScaleX() != scale) {
font.setScale(scale);
font.getData(). setScale(scale);
}
}
@ -200,7 +220,7 @@ public class FSkinFont {
FThreads.invokeInEdtNowOrLater(new Runnable() {
@Override
public void run() {
TextureRegion[] textureRegions = new TextureRegion[pages.size];
Array<TextureRegion> textureRegions = new Array<TextureRegion>();
for (int i = 0; i < pages.size; i++) {
PixmapPacker.Page p = pages.get(i);
Texture texture = new Texture(new PixmapTextureData(p.getPixmap(), p.getPixmap().getFormat(), false, false)) {
@ -211,7 +231,7 @@ public class FSkinFont {
}
};
texture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
textureRegions[i] = new TextureRegion(texture);
textureRegions.add(new TextureRegion(texture));
}
font = new BitmapFont(fontData, textureRegions, true);

View File

@ -7,12 +7,14 @@ import java.util.Map;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.Graphics;
import forge.card.CardFaceSymbols;
import forge.model.FModel;
import forge.properties.ForgePreferences;
import forge.properties.ForgePreferences.FPref;
import forge.toolbox.TextBounds;
//Encodes text for drawing with symbols and reminder text
public class TextRenderer {
@ -522,10 +524,10 @@ public class TextRenderer {
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) {
drawText(g, text, skinFont, skinColor.getColor(), x, y, w, h, visibleStartY, visibleHeight, wrap0, horzAlignment, 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 halign, boolean centerVertically) {
drawText(g, text, skinFont, skinColor.getColor(), x, y, w, h, visibleStartY, visibleHeight, wrap0, halign, 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 halign, boolean centerVertically) {
setProps(text, skinFont, w, h, wrap0);
if (needClip) { //prevent text flowing outside region if couldn't shrink it to fit
g.startClip(x, y, w, h);
@ -535,14 +537,14 @@ public class TextRenderer {
}
float[] alignmentOffsets = new float[lineWidths.size()];
for (int i = 0; i < lineWidths.size(); i++) {
switch (horzAlignment) {
case LEFT:
switch (halign) {
case Align.left:
alignmentOffsets[i] = 0;
break;
case CENTER:
case Align.center:
alignmentOffsets[i] = Math.max((width - lineWidths.get(i)) / 2, 0);
break;
case RIGHT:
case Align.right:
alignmentOffsets[i] = Math.max(width - lineWidths.get(i), 0);
break;
}
@ -597,7 +599,7 @@ public class TextRenderer {
else if (inReminderText) {
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,8 @@ package forge.card;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import com.google.common.collect.ImmutableList;
import forge.Graphics;
import forge.assets.*;
@ -175,7 +176,7 @@ public class CardImageRenderer {
CardFaceSymbols.drawManaCost(g, otherManaCost, x + w - manaCostWidth, y + (h - MANA_SYMBOL_SIZE) / 2, MANA_SYMBOL_SIZE);
//draw "//" between two parts of mana cost
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;
CardFaceSymbols.drawManaCost(g, mainManaCost, x + w - manaCostWidth, y + (h - MANA_SYMBOL_SIZE) / 2, MANA_SYMBOL_SIZE);
@ -183,7 +184,7 @@ public class CardImageRenderer {
//draw name for card
x += 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;
@ -221,7 +222,7 @@ public class CardImageRenderer {
//draw type
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
@ -268,7 +269,7 @@ public class CardImageRenderer {
y += padding;
w -= 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 +314,7 @@ public class CardImageRenderer {
x += (boxWidth - totalPieceWidth) / 2;
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];
}
}
@ -451,7 +452,7 @@ public class CardImageRenderer {
CardFaceSymbols.drawManaCost(g, otherManaCost, x + w - manaCostWidth, y + (h - MANA_SYMBOL_SIZE) / 2, MANA_SYMBOL_SIZE);
//draw "//" between two parts of mana cost
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;
CardFaceSymbols.drawManaCost(g, mainManaCost, x + w - manaCostWidth, y + (h - MANA_SYMBOL_SIZE) / 2, MANA_SYMBOL_SIZE);
@ -460,7 +461,7 @@ public class CardImageRenderer {
//draw name for card
x += 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
y += h;
@ -478,7 +479,7 @@ public class CardImageRenderer {
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) {
@ -491,14 +492,14 @@ public class CardImageRenderer {
y += padY;
w -= 2 * padX;
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) {
float idWidth = 0;
if (canShow) {
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;
}
@ -513,6 +514,6 @@ public class CardImageRenderer {
fillColorBackground(g, colors, 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

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

View File

@ -8,11 +8,13 @@ import com.badlogic.gdx.graphics.Pixmap;
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.GlyphLayout;
import com.badlogic.gdx.graphics.g2d.PixmapPacker;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter;
import com.badlogic.gdx.graphics.glutils.PixmapTextureData;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.Array;
import forge.FThreads;
import forge.Graphics;
@ -34,6 +36,7 @@ import forge.properties.ForgePreferences;
import forge.properties.ForgePreferences.FPref;
import forge.screens.match.MatchController;
import forge.toolbox.FList;
import forge.toolbox.TextBounds;
import forge.util.Utils;
import org.apache.commons.lang3.StringUtils;
@ -64,6 +67,8 @@ public class CardRenderer {
private static final Color counterBackgroundColor = new Color(0f, 0f, 0f, 0.9f);
private static final Map<CounterType, Color> counterColorCache = new HashMap<>();
private static GlyphLayout glyphLayout = new GlyphLayout();
static {
try {
for (int fontSize = 11; fontSize <= 22; fontSize++) {
@ -219,7 +224,7 @@ public class CardRenderer {
if (suffix != null) {
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);
}
}
@ -268,7 +273,7 @@ public class CardRenderer {
CardFaceSymbols.drawManaCost(g, otherManaCost, x + w - manaCostWidth + MANA_COST_PADDING, y, MANA_SYMBOL_SIZE);
//draw "//" between two parts of mana cost
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);
CardFaceSymbols.drawManaCost(g, mainManaCost, x + w - manaCostWidth, y, MANA_SYMBOL_SIZE);
@ -281,7 +286,7 @@ public class CardRenderer {
if (suffix != null) {
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) {
return; //skip second line if rendering in compact mode
@ -308,7 +313,7 @@ public class CardRenderer {
else if (card.getCurrentState().getType().hasSubtype("Vehicle")) {
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) {
@ -337,7 +342,7 @@ public class CardRenderer {
Color backColor = getRarityColor(rarity);
Color foreColor = FSkinColor.getHighContrastColor(backColor);
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) {
@ -403,7 +408,7 @@ public class CardRenderer {
//draw name and mana cost overlays if card is small or default card image being used
if (h <= NAME_COST_THRESHOLD && canShow) {
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)) {
float manaSymbolSize = w / 4;
@ -432,7 +437,7 @@ public class CardRenderer {
if (canShow && showCardIdOverlay(card)) {
FSkinFont idFont = FSkinFont.forHeight(h * 0.12f);
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()) {
@ -512,7 +517,9 @@ public class CardRenderer {
maxCounters = Math.max(maxCounters, numberOfCounters);
}
if (counterBoxBaseWidth + font.getBounds(String.valueOf(maxCounters)).width > w) {
glyphLayout.setText(font, String.valueOf(maxCounters));
if (counterBoxBaseWidth + glyphLayout.width > w) {
drawCounterImage(card, g, x, y, w, h);
return;
}
@ -523,7 +530,10 @@ public class CardRenderer {
final CounterType counter = counterEntry.getKey();
final int numberOfCounters = counterEntry.getValue();
final float counterBoxRealWidth = counterBoxBaseWidth + font.getBounds(String.valueOf(numberOfCounters)).width + 4;
glyphLayout.setText(font, String.valueOf(numberOfCounters));
final float counterBoxRealWidth = glyphLayout.width + 4;
final float counterYOffset = spaceFromTopOfCard - (currentCounter++ * (counterBoxHeight + counterBoxSpacing));
@ -535,8 +545,8 @@ public class CardRenderer {
Color counterColor = counterColorCache.get(counter);
drawText(g, counter.getCounterOnCardDisplayName(), font, counterColor, x + 2 + additionalXOffset, counterYOffset, counterBoxRealWidth, counterBoxHeight, HAlignment.LEFT);
drawText(g, String.valueOf(numberOfCounters), font, counterColor, x + counterBoxBaseWidth - 4f - 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, Align.left);
}
@ -544,21 +554,24 @@ public class CardRenderer {
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 halign) {
if (color.a < 1) { //enable blending so alpha colored shapes work properly
Gdx.gl.glEnable(GL_BLEND);
}
TextBounds textBounds = font.getMultiLineBounds(text);
glyphLayout.setText(font, text, color, w, halign, true);
float textHeight = textBounds.height;
//TextBounds textBounds = font.getMultiLineBounds(text);
float textHeight = glyphLayout.height;
if (h > textHeight) {
y += (h - textHeight) / 2;
}
font.setColor(color);
font.drawMultiLine(g.getBatch(), text, g.adjustX(x), g.adjustY(y, 0), w, horizontalAlignment);
//font.setColor(color);
// font.drawMultiLine(g.getBatch(), text, g.adjustX(x), g.adjustY(y, 0), w, alignment);
font.draw(g.getBatch(), glyphLayout, g.adjustX(x), g.adjustY(y, 0));
if (color.a < 1) {
Gdx.gl.glDisable(GL_BLEND);
@ -641,7 +654,7 @@ public class CardRenderer {
//draw card damage above P/T box if needed
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);
@ -649,7 +662,7 @@ public class CardRenderer {
x += padding;
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);
}
}
@ -727,7 +740,7 @@ public class CardRenderer {
@Override
public void run() {
TextureRegion[] textureRegions = new TextureRegion[pages.size];
Array<TextureRegion> textureRegions = new Array<TextureRegion>();
for (int i = 0; i < pages.size; i++) {
PixmapPacker.Page p = pages.get(i);
Texture texture = new Texture(new PixmapTextureData(p.getPixmap(), p.getPixmap().getFormat(), false, false)) {
@ -738,7 +751,7 @@ public class CardRenderer {
}
};
texture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
textureRegions[i] = new TextureRegion(texture);
textureRegions.add(new TextureRegion(texture));
}
counterFonts.put(fontSize, new BitmapFont(fontData, textureRegions, true));

View File

@ -6,6 +6,7 @@ import java.util.Map.Entry;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.utils.Align;
import forge.Forge;
import forge.Graphics;
@ -250,10 +251,10 @@ public class CardZoom extends FOverlay {
if (currentActivateAction != null) {
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.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

View File

@ -20,6 +20,7 @@ package forge.deck;
import java.text.NumberFormat;
import java.util.Map.Entry;
import com.badlogic.gdx.utils.Align;
import com.google.common.collect.Iterables;
import forge.Forge;
import forge.Graphics;
@ -122,7 +123,7 @@ public class AddBasicLandsDialog extends FDialog {
callback = callback0;
currentDeck = deck;
lblDeckInfo.setAlignment(HAlignment.CENTER);
lblDeckInfo.setAlignment(Align.center);
lblDeckInfo.setFont(FSkinFont.get(12));
cbLandSet.setFont(lblLandSet.getFont());
@ -322,7 +323,7 @@ public class AddBasicLandsDialog extends FDialog {
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() {
@Override
public void handleEvent(FEvent e) {

View File

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

View File

@ -3,6 +3,7 @@ package forge.deck;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Align;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.base.Supplier;
@ -223,8 +224,8 @@ public class FDeckEditor extends TabPageScreen<FDeckEditor> {
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());
private final FLabel btnSave = deckHeader.add(new FLabel.Builder().icon(FSkinImage.SAVE).align(HAlignment.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 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(Align.center).pressedColor(Header.BTN_PRESSED_COLOR).build());
public FDeckEditor(EditorType editorType0, DeckProxy editDeck, boolean showMainDeck) {
this(editorType0, editDeck.getName(), editDeck.getPath(), null, showMainDeck);

View File

@ -1,7 +1,7 @@
package forge.error;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.graphics.g2d.BitmapFont.TextBounds;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.Forge;
import forge.Graphics;
@ -14,6 +14,7 @@ import forge.toolbox.FEvent;
import forge.toolbox.FEvent.FEventHandler;
import forge.toolbox.FScrollPane;
import forge.toolbox.FTextArea;
import forge.toolbox.TextBounds;
import forge.util.Callback;
import forge.util.Utils;
@ -147,7 +148,7 @@ public class BugReportDialog extends FScreen { //use screen rather than dialog s
@Override
public void drawBackground(Graphics g) {
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

View File

@ -21,6 +21,7 @@ import forge.toolbox.FList.CompactModeHandler;
import forge.util.Utils;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import java.util.Map.Entry;
@ -118,7 +119,7 @@ public final class DeckManager extends ItemManager<DeckProxy> implements IHasGam
if (DeckManager.this.getConfig().getCols().size() == 1) {
//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.center, true);
return;
}
@ -131,7 +132,7 @@ public final class DeckManager extends ItemManager<DeckProxy> implements IHasGam
if (!deck.getPath().isEmpty()) { //render path after name if needed
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;
CardFaceSymbols.drawColorSet(g, deckColor, x, y, IMAGE_SIZE);
@ -158,7 +159,7 @@ public final class DeckManager extends ItemManager<DeckProxy> implements IHasGam
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;
y -= CardRenderer.SET_BOX_MARGIN;

View File

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

View File

@ -4,6 +4,7 @@ import java.util.Map.Entry;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import com.google.common.base.Function;
import forge.Graphics;
@ -67,7 +68,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());
}
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());
if (image != null) {
float imageRatio = (float)image.getWidth() / (float)image.getHeight();
@ -87,7 +88,7 @@ public class SpellShopManager extends ItemManager<InventoryItem> {
g.fillRect(backColor, x - FList.PADDING, y, cardArtWidth, priceHeight);
g.drawImage(FSkinImage.QUEST_COINSTACK, x, y, priceHeight, priceHeight);
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

View File

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

View File

@ -29,6 +29,7 @@ import java.util.List;
import java.util.Set;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
public abstract class FormatFilter<T extends InventoryItem> extends ItemFilter<T> {
@ -219,7 +220,7 @@ public abstract class FormatFilter<T extends InventoryItem> extends ItemFilter<T
float textHeight = h;
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;
y += (textHeight - h) / 2;

View File

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

View File

@ -1,6 +1,7 @@
package forge.itemmanager.filters;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
@ -101,7 +102,7 @@ public class TextSearchFilter<T extends InventoryItem> extends ItemFilter<T> {
@Override
public void draw(Graphics 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

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

View File

@ -1,6 +1,7 @@
package forge.itemmanager.filters;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import com.google.common.base.Predicate;
import forge.card.CardRules;
@ -55,7 +56,7 @@ public abstract class ValueRangeFilter<T extends InventoryItem> extends ItemFilt
lowerBound = addSpinner(widget, true);
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);
upperBound = addSpinner(widget, false);

View File

@ -31,6 +31,7 @@ import forge.toolbox.FEvent.FEventHandler;
import forge.toolbox.FLabel;
import forge.toolbox.FScrollPane;
import forge.util.Utils;
import sun.security.x509.AlgIdDSA;
import java.util.*;
import java.util.Map.Entry;
@ -40,6 +41,7 @@ import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Align;
public class ImageView<T extends InventoryItem> extends ItemView<T> {
private static final float PADDING = Utils.scale(5);
@ -789,7 +791,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
float x = GROUP_HEADER_GLYPH_WIDTH + PADDING + 1;
float y = 0;
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;
y += GROUP_HEADER_HEIGHT / 2;
g.drawLine(GROUP_HEADER_LINE_THICKNESS, GROUP_HEADER_LINE_COLOR, x, y, getWidth(), y);
@ -958,7 +960,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
}
else {
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,12 +1,14 @@
package forge.menu;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.Graphics;
import forge.assets.FSkinColor;
import forge.assets.FSkinFont;
import forge.assets.TextRenderer;
import forge.toolbox.FDisplayObject;
import forge.toolbox.TextBounds;
import forge.util.Utils;
public class FMagnifyView extends FDropDown {
@ -65,6 +67,6 @@ public class FMagnifyView extends FDropDown {
public void drawBackground(Graphics g) {
super.drawBackground(g);
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;
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.Task;
@ -135,10 +135,11 @@ public class FMenuItem extends FDisplayObject implements IButton {
}
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 {
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

View File

@ -1,6 +1,7 @@
package forge.menu;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.Graphics;
import forge.assets.FSkinColor;
@ -99,6 +100,6 @@ public class FMenuTab extends FDisplayObject {
y = PADDING;
w = getWidth() - 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,7 +1,7 @@
package forge.menu;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.graphics.g2d.BitmapFont.TextBounds;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.Forge;
import forge.Graphics;
@ -10,6 +10,7 @@ import forge.assets.FSkinFont;
import forge.assets.FSkinColor.Colors;
import forge.screens.FScreen;
import forge.toolbox.FDisplayObject;
import forge.toolbox.TextBounds;
import forge.util.Utils;
public class FTooltip extends FDropDown {
@ -68,6 +69,6 @@ public class FTooltip extends FDropDown {
@Override
public void drawBackground(Graphics 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

@ -5,6 +5,7 @@ import java.util.List;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.utils.Align;
import forge.Forge;
import forge.Graphics;
@ -197,13 +198,13 @@ public abstract class FScreen extends FContainer {
protected final FLabel btnBack, lblCaption;
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
public void handleEvent(FEvent e) {
Forge.back();
}
}).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
@ -245,7 +246,7 @@ public abstract class FScreen extends FContainer {
public MenuHeader(String headerCaption, FPopupMenu menu0) {
super(headerCaption);
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
public void handleEvent(FEvent e) {
menu.show(btnMenu, 0, HEIGHT);

View File

@ -1,6 +1,7 @@
package forge.screens;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.FThreads;
import forge.Forge;
@ -95,6 +96,6 @@ public class LoadingOverlay extends FOverlay {
y += padding;
g.drawImage(FSkinImage.LOGO, (getWidth() - logoSize) / 2f, y, logoSize, logoSize);
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,8 @@ package forge.screens;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.Forge;
import forge.Graphics;
@ -94,7 +95,7 @@ public class SplashScreen extends FContainer {
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.";
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 pbHeight = 57f / 450f * h;
@ -103,6 +104,6 @@ public class SplashScreen extends FContainer {
g.draw(progressBar);
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,7 @@
package forge.screens;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.Forge;
import forge.Graphics;
@ -183,7 +184,7 @@ public class TabPageScreen<T extends TabPageScreen<T>> extends FScreen {
public TabHeader(TabPage<T>[] tabPages0, boolean showBackButton) {
tabPages = tabPages0;
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
public void handleEvent(FEvent e) {
Forge.back();
@ -365,7 +366,7 @@ public class TabPageScreen<T extends TabPageScreen<T>> extends FScreen {
if (parentScreen.showCompactTabs() && !isLandscapeMode) {
h -= 2 * padding;
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 {
//center combination of icon and text
@ -393,13 +394,13 @@ public class TabPageScreen<T extends TabPageScreen<T>> extends FScreen {
x += iconOffset;
w -= iconOffset;
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();
}
}
else {
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) {
float iconHeight = y - 2 * padding;

View File

@ -1,8 +1,9 @@
package forge.screens.achievements;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.utils.Align;
import forge.Forge;
import forge.Graphics;
@ -54,7 +55,7 @@ public class AchievementsScreen extends FScreen {
AchievementCollection.buildComboBox(cbCollections);
cbCollections.setSelectedIndex(0);
cbCollections.setAlignment(HAlignment.CENTER);
cbCollections.setAlignment(Align.center);
cbCollections.setChangedHandler(new FEventHandler() {
@Override
public void handleEvent(FEvent e) {
@ -271,11 +272,11 @@ public class AchievementsScreen extends FScreen {
if (plateY + plateHeight > 0) {
g.drawImage((FImage)achievement.getImage(), x + trophyOffset, y, trophyImageWidth, trophyHeight);
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);
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) {
@ -338,40 +339,40 @@ public class AchievementsScreen extends FScreen {
y += PADDING;
w -= 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();
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 += PADDING;
if (sharedDesc != null) {
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();
}
if (mythicDesc != null) {
g.drawText(selectedAchievement.isSpecial() ? mythicDesc : "(Mythic) " + mythicDesc, DESC_FONT, //handle flavor text here too
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();
}
if (rareDesc != null) {
g.drawText("(Rare) " + rareDesc, DESC_FONT,
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();
}
if (uncommonDesc != null) {
g.drawText("(Uncommon) " + uncommonDesc, DESC_FONT,
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();
}
if (commonDesc != null) {
g.drawText("(Common) " + commonDesc, DESC_FONT,
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

@ -20,6 +20,7 @@ import java.util.Map;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
public class AvatarSelector extends FScreen {
public static int getRandomAvatar(List<Integer> usedAvatars) {
@ -87,7 +88,7 @@ public class AvatarSelector extends FScreen {
}
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)
.build();

View File

@ -6,6 +6,7 @@ import org.apache.commons.lang3.StringUtils;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import com.google.common.collect.Iterables;
import forge.FThreads;
@ -394,10 +395,10 @@ public abstract class LobbyScreen extends LaunchScreen implements ILobbyView {
float totalHeight = h;
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);
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

@ -7,6 +7,7 @@ import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
@ -692,7 +693,7 @@ public class PlayerPanel extends FContainer {
/** Adds a pre-styled FLabel component with the specified 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");

View File

@ -7,7 +7,8 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.FThreads;
import forge.Graphics;
@ -253,8 +254,8 @@ public class LoadGauntletScreen extends LaunchScreen {
String progress = completed + " / " + opponents + " (" + percent.format((double)completed / (double)opponents) + ")";
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(progress, font, foreColor, x, y, w, h, false, HAlignment.RIGHT, 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, Align.right, false);
h += SettingsScreen.SETTING_PADDING;
y += h;
@ -263,8 +264,8 @@ public class LoadGauntletScreen extends LaunchScreen {
String timestamp = value.getTimestamp();
font = FSkinFont.get(12);
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(timestamp, font, SettingsScreen.DESC_COLOR, x + w - timestampWidth + SettingsScreen.SETTING_PADDING, y, w, 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, Align.left, false);
}
});
}

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.Forge;
import forge.Graphics;
@ -245,7 +246,7 @@ public class HomeScreen extends FScreen {
public void draw(Graphics g) {
if (Forge.isLandscapeMode()) {
//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
super.draw(g);

View File

@ -1,6 +1,7 @@
package forge.screens.limited;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.FThreads;
import forge.Forge;
@ -39,7 +40,7 @@ public class LoadDraftScreen extends LaunchScreen {
private final FLabel lblTip = add(new FLabel.Builder()
.text("Double-tap to edit deck (Long-press to view)")
.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 FLabel lblMode = add(new FLabel.Builder().text("Mode:").font(GAME_MODE_FONT).build());

View File

@ -1,6 +1,8 @@
package forge.screens.limited;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.FThreads;
import forge.Forge;
@ -39,7 +41,7 @@ public class LoadSealedScreen extends LaunchScreen {
private final FLabel lblTip = add(new FLabel.Builder()
.text("Double-tap to edit deck (Long-press to view)")
.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 FLabel lblMode = add(new FLabel.Builder().text("Mode:").font(GAME_MODE_FONT).build());

View File

@ -48,7 +48,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
public class VAssignDamage extends FDialog {
private static final float CARD_GAP_X = Utils.scale(10);
@ -64,8 +65,8 @@ public class VAssignDamage extends FDialog {
private final GameEntityView defender;
private final FLabel lblTotalDamage = add(new FLabel.Builder().text("Available damage points: Unknown").align(HAlignment.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 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(Align.center).build());
private final AttDefCardPanel pnlAttacker;
private final DefendersPanel pnlDefenders;
@ -215,7 +216,7 @@ public class VAssignDamage extends FDialog {
else {
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() {
@Override
public void handleEvent(FEvent e) {
@ -284,7 +285,7 @@ public class VAssignDamage extends FDialog {
float w = getWidth();
float h = getHeight();
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,7 +3,7 @@ package forge.screens.match.views;
import java.util.ArrayList;
import java.util.List;
import com.badlogic.gdx.graphics.g2d.BitmapFont.TextBounds;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import forge.screens.match.MatchController;
import forge.toolbox.FCheckBox;
@ -12,6 +12,7 @@ import forge.toolbox.FDialog;
import forge.toolbox.FEvent;
import forge.toolbox.FEvent.FEventHandler;
import forge.toolbox.FOptionPane;
import forge.toolbox.TextBounds;
public class VAutoYields extends FDialog {
private final FChoiceList<String> lstAutoYields;

View File

@ -3,6 +3,7 @@ package forge.screens.match.views;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Align;
import forge.Graphics;
import forge.assets.FImage;
@ -64,7 +65,7 @@ public class VAvatar extends FDisplayObject {
//use font and padding from phase indicator so text lines up
FSkinFont font = VPhaseIndicator.BASE_FONT;
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

@ -3,6 +3,7 @@ package forge.screens.match.views;
import java.util.List;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.Graphics;
import forge.assets.FSkinColor;
@ -108,7 +109,7 @@ public class VLog extends FDropDown {
}
//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

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.Forge;
import forge.Graphics;
@ -148,7 +149,7 @@ public class VManaPool extends VDisplayArea {
w = getWidth();
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

@ -5,6 +5,7 @@ import java.util.Map;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.Graphics;
import forge.assets.FSkinColor;
@ -13,6 +14,7 @@ import forge.assets.FSkinColor.Colors;
import forge.game.phase.PhaseType;
import forge.toolbox.FContainer;
import forge.toolbox.FDisplayObject;
import forge.toolbox.TextBounds;
import forge.util.Utils;
public class VPhaseIndicator extends FContainer {
@ -159,7 +161,7 @@ public class VPhaseIndicator extends FContainer {
backColor = FSkinColor.get(Colors.CLR_PHASE_INACTIVE_DISABLED);
}
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

@ -7,6 +7,7 @@ import java.util.Map;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.Forge;
import forge.Graphics;
@ -379,21 +380,21 @@ public class VPlayerPanel extends FContainer {
@Override
public void draw(Graphics g) {
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 {
float halfHeight = getHeight() / 2;
float textStart = halfHeight + Utils.scale(1);
float textWidth = getWidth() - textStart;
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
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 {
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);
}
}
}
@ -495,10 +496,10 @@ public class VPlayerPanel extends FContainer {
}
x += w + INFO_TAB_PADDING_X;
HAlignment alignX = HAlignment.LEFT;
int alignX = Align.left;
if (lblLife.getRotate180()) {
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);
if (lblLife.getRotate180()) {
@ -520,7 +521,7 @@ public class VPlayerPanel extends FContainer {
g.drawImage(icon, x, y, w, h);
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()) {
g.endTransform();
}

View File

@ -1,6 +1,7 @@
package forge.screens.match.views;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.Graphics;
import forge.assets.FImage;
@ -62,7 +63,7 @@ public class VPlayers extends FDropDown {
g.drawImage(avatarImage, x, y, h, h);
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

View File

@ -2,8 +2,8 @@ package forge.screens.match.views;
import org.apache.commons.lang3.StringUtils;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.graphics.g2d.BitmapFont.TextBounds;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.Graphics;
import forge.assets.FSkinColor;
@ -18,6 +18,7 @@ import forge.toolbox.FButton.Corner;
import forge.toolbox.FContainer;
import forge.toolbox.FDisplayObject;
import forge.toolbox.FEvent.FEventHandler;
import forge.toolbox.TextBounds;
import forge.util.Utils;
public class VPrompt extends FContainer {
@ -125,7 +126,7 @@ public class VPrompt extends FContainer {
float y = PADDING;
float w = getWidth() - 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

@ -8,6 +8,7 @@ import java.util.Set;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Align;
import forge.Forge;
import forge.Graphics;
@ -135,7 +136,7 @@ public class VStack extends FDropDown {
final FCollectionView<StackItemView> stack = MatchController.instance.getGameView().getStack();
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;
label.setBounds(x, y, width, height);
@ -374,7 +375,7 @@ public class VStack extends FDropDown {
x += CARD_WIDTH + PADDING;
w -= x + 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();

View File

@ -2,6 +2,8 @@ package forge.screens.match.winlose;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.FThreads;
import forge.Forge;
import forge.assets.FSkinColor;
@ -40,8 +42,8 @@ public class ViewWinLose extends FOverlay implements IWinLoseView<FButton> {
game = game0;
lblTitle = add(new FLabel.Builder().font(FSkinFont.get(30)).align(HAlignment.CENTER).build());
lblStats = add(new FLabel.Builder().font(FSkinFont.get(26)).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(Align.center).build());
pnlOutcomes = add(new OutcomesPanel());
btnContinue = add(new FButton());
@ -88,7 +90,7 @@ public class ViewWinLose extends FOverlay implements IWinLoseView<FButton> {
btnQuit.setFont(btnContinue.getFont());
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]")) {
@Override
public boolean tap(float x, float y, int count) {

View File

@ -1,7 +1,8 @@
package forge.screens.online;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.Graphics;
import forge.assets.FSkinColor;
@ -149,7 +150,7 @@ public class OnlineChatScreen extends FScreen implements IOnlineChatInterface {
float w = getWidth() - TRIANGLE_WIDTH;
float h = getHeight() - TEXT_INSET;
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();
//draw bubble fill

View File

@ -7,6 +7,7 @@ import java.util.Set;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.utils.Align;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableList;
@ -63,7 +64,7 @@ public class ConquestAEtherScreen extends FScreen {
private final FilterButton btnRarityFilter = add(new FilterButton("Rarity", ConquestUtil.RARITY_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 int shardCost;
@ -272,7 +273,7 @@ public class ConquestAEtherScreen extends FScreen {
activePullAnimation.drawCard(g);
}
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);
}
}
@ -360,7 +361,7 @@ public class ConquestAEtherScreen extends FScreen {
private FilterButton(String caption0, AEtherFilter[] options0) {
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;
options = ImmutableList.copyOf(options0);
setSelectedOption(options.get(0));

View File

@ -3,6 +3,7 @@ package forge.screens.planarconquest;
import java.util.Map.Entry;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import com.google.common.base.Predicate;
import forge.Forge;
@ -217,7 +218,7 @@ public class ConquestCommandersScreen extends FScreen {
float imageSize = CardRenderer.MANA_SYMBOL_SIZE;
ColorSet cardColor = card.getRules().getColorIdentity();
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);
if (compactModeHandler.isCompactMode()) {
@ -233,7 +234,7 @@ public class ConquestCommandersScreen extends FScreen {
float setWidth = CardRenderer.getSetWidth(font, set);
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;
y -= CardRenderer.SET_BOX_MARGIN;

View File

@ -8,6 +8,7 @@ import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Align;
import forge.FThreads;
import forge.Forge;
@ -646,7 +647,7 @@ public class ConquestMultiverseScreen extends FScreen {
float y = PADDING;
float symbolSize = CardRenderer.MANA_SYMBOL_SIZE;
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;
CardFaceSymbols.drawColorSet(g, regionColors, x, y, symbolSize);
@ -658,7 +659,7 @@ public class ConquestMultiverseScreen extends FScreen {
}
x = PADDING;
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
g.drawLine(1, Color.BLACK, 0, 0, w, 0);
@ -707,10 +708,10 @@ public class ConquestMultiverseScreen extends FScreen {
float labelHeight = playerAvatar.getTop();
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) {
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

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

View File

@ -2,6 +2,7 @@ package forge.screens.planarconquest;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.Forge;
import forge.Graphics;
@ -56,7 +57,7 @@ public class ConquestPlaneswalkScreen extends FScreen {
private PlaneswalkButton() {
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() {
@Override
public void handleEvent(FEvent e) {

View File

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

View File

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

View File

@ -10,6 +10,7 @@ import java.util.Map;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.FThreads;
import forge.Graphics;
@ -55,7 +56,7 @@ public class LoadConquestScreen extends LaunchScreen {
super(null, LoadGameMenu.getMenu());
lblOldConquests.setFont(FSkinFont.get(12));
lblOldConquests.setAlignment(HAlignment.CENTER);
lblOldConquests.setAlignment(Align.center);
btnNewConquest.setFont(FSkinFont.get(16));
btnNewConquest.setCommand(new FEventHandler() {
@ -301,8 +302,8 @@ public class LoadConquestScreen extends LaunchScreen {
String progress = value.getProgress();
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(progress, font, foreColor, x, y, w, h, false, HAlignment.RIGHT, 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, Align.right, false);
h += SettingsScreen.SETTING_PADDING;
y += h;
@ -315,11 +316,11 @@ public class LoadConquestScreen extends LaunchScreen {
font = FSkinFont.get(12);
float cardsWidth = font.getBounds(cards).width + iconSize + SettingsScreen.SETTING_PADDING;
float shardsWidth = font.getBounds(shards).width + iconSize + SettingsScreen.SETTING_PADDING;
g.drawText(value.getPlaneswalker().getName() + " - " + value.getCurrentPlane().getName(), font, SettingsScreen.DESC_COLOR, x, y, w - shardsWidth - cardsWidth, h, false, HAlignment.LEFT, false);
g.drawText(value.getPlaneswalker().getName() + " - " + value.getCurrentPlane().getName(), 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.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.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,6 +11,7 @@ import java.util.Map;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.FThreads;
import forge.Forge;
@ -56,7 +57,7 @@ public class LoadQuestScreen extends LaunchScreen {
super(null, LoadGameMenu.getMenu());
lblOldQuests.setFont(FSkinFont.get(12));
lblOldQuests.setAlignment(HAlignment.CENTER);
lblOldQuests.setAlignment(Align.center);
btnNewQuest.setFont(FSkinFont.get(16));
btnNewQuest.setCommand(new FEventHandler() {
@ -297,8 +298,8 @@ public class LoadQuestScreen extends LaunchScreen {
String winRatio = value.getAchievements().getWin() + "W / " + value.getAchievements().getLost() + "L";
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(winRatio, font, foreColor, x, y, w, h, false, HAlignment.RIGHT, 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, Align.right, false);
h += SettingsScreen.SETTING_PADDING;
y += h;
@ -311,11 +312,11 @@ public class LoadQuestScreen extends LaunchScreen {
font = FSkinFont.get(12);
float cardsWidth = font.getBounds(cards).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.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.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,7 @@
package forge.screens.quest;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.FThreads;
import forge.UiCommand;
@ -92,7 +93,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
x += obj.getWidth();
continue;
} else if (lbl.getAlignment() == HAlignment.RIGHT) {
} else if (lbl.getAlignment() == Align.right) {
y -= gapY; //remove most of the padding above description text
}
}
@ -118,7 +119,7 @@ public class NewQuestScreen extends FScreen {
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 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 FComboBox<String> cbxPreconDeck = scroller.add(new FComboBox<String>());
@ -158,8 +159,8 @@ public class NewQuestScreen extends FScreen {
private final FLabel lblPrizeFormat = scroller.add(new FLabel.Builder().text("Sanctioned format:").build());
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 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 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(Align.right).font(FSkinFont.get(12)).text("Only sets found in starting pool will be available.").build());
private final FLabel btnPrizeDefineCustomFormat = scroller.add(new FLabel.ButtonBuilder().text("Define custom format").build());
private final FCheckBox cbAllowUnlocks = scroller.add(new FCheckBox("Allow unlock of additional editions"));

View File

@ -5,6 +5,7 @@ import java.util.Set;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Align;
import forge.Forge;
import forge.Graphics;
@ -56,12 +57,12 @@ public class QuestBazaarScreen extends TabPageScreen<QuestBazaarScreen> {
private static final float PADDING = Utils.scale(5);
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))
.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 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 FScrollPane scroller = add(new FScrollPane() {
@Override
@ -87,7 +88,7 @@ public class QuestBazaarScreen extends TabPageScreen<QuestBazaarScreen> {
stallDef = stallDef0;
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
}

View File

@ -2,6 +2,7 @@ package forge.screens.quest;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Align;
import forge.assets.FSkinFont;
import forge.interfaces.IButton;
@ -10,14 +11,14 @@ import forge.toolbox.FLabel;
public class QuestChallengesScreen extends QuestLaunchScreen {
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()
.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());
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());
private final QuestEventPanel.Container pnlChallenges = add(new QuestEventPanel.Container());

View File

@ -2,6 +2,8 @@ package forge.screens.quest;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Align;
import forge.assets.FSkinFont;
import forge.interfaces.IButton;
import forge.model.FModel;
@ -15,14 +17,14 @@ import java.util.List;
public class QuestDuelsScreen extends QuestLaunchScreen {
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()
.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());
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());
private final QuestEventPanel.Container pnlDuels = add(new QuestEventPanel.Container());

View File

@ -2,6 +2,8 @@ package forge.screens.quest;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.Graphics;
import forge.assets.*;
import forge.assets.FSkinColor.Colors;
@ -109,11 +111,11 @@ class QuestEventPanel extends FDisplayObject {
//draw title
w -= x + 2 * (RADIO_BUTTON_RADIUS + PADDING);
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
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
x = getWidth() - PADDING - RADIO_BUTTON_RADIUS;

View File

@ -7,6 +7,7 @@ import java.util.Map;
import java.util.Map.Entry;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.FThreads;
import forge.assets.FImage;
@ -315,7 +316,7 @@ public class QuestSpellShopScreen extends TabPageScreen<QuestSpellShopScreen> {
private static class InventoryPage extends SpellShopBasePage {
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() {
@Override
public void handleEvent(FEvent e) {

View File

@ -2,6 +2,7 @@ package forge.screens.quest;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Align;
import forge.FThreads;
import forge.Forge;
@ -45,10 +46,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 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()
.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());
private final QuestEventPanel.Container pnlTournaments = pnlSelectTournament.add(new QuestEventPanel.Container());
@ -372,7 +373,7 @@ public class QuestTournamentsScreen extends QuestLaunchScreen implements IQuestT
int[] iconIDs = new int[16];
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);
y += lblStandings.getHeight() + PADDING;
@ -385,7 +386,7 @@ public class QuestTournamentsScreen extends QuestLaunchScreen implements IQuestT
String sid = qd.getStandings()[qd.getStandings().length - 1];
String winnersName = sid.equals(QuestEventDraft.HUMAN) ? FModel.getPreferences().getPref(FPref.PLAYER_NAME) :
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);
y += lblWinner.getHeight() + PADDING;
getBtnLeaveTournamentInTourn().setText("Collect Prizes");
@ -427,17 +428,17 @@ public class QuestTournamentsScreen extends QuestLaunchScreen implements IQuestT
for (int j = 0; j < 13; j += 2) {
switch (j) {
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);
y += qfinals.getHeight() + PADDING;
break;
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);
y += sfinals.getHeight() + PADDING;
break;
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);
y += finals.getHeight() + PADDING;
break;
@ -453,7 +454,7 @@ public class QuestTournamentsScreen extends QuestLaunchScreen implements IQuestT
FTextureRegionImage avatar1 = new FTextureRegionImage(FSkin.getAvatars().get(iconIDs[j]));
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);
if (currentMatch) {
labels[j].setTextColor(FSkinColor.get(FSkinColor.Colors.CLR_ACTIVE));

View File

@ -3,7 +3,8 @@ package forge.screens.settings;
import forge.download.*;
import org.apache.commons.lang3.StringUtils;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.Graphics;
import forge.assets.FSkinColor;
@ -132,9 +133,9 @@ public class FilesPage extends TabPage<SettingsScreen> {
float totalHeight = h;
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;
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,8 @@
package forge.screens.settings;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.Forge;
import forge.Graphics;
import forge.ai.AiProfileUtil;
@ -409,7 +411,7 @@ public class SettingsPage extends TabPage<SettingsScreen> {
w -= 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;
x += w - radius;
@ -438,7 +440,7 @@ public class SettingsPage extends TabPage<SettingsScreen> {
@Override
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);
}
}
@ -465,10 +467,10 @@ public class SettingsPage extends TabPage<SettingsScreen> {
float totalHeight = h;
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);
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

@ -9,7 +9,8 @@ import java.util.Collection;
import java.util.List;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
// An input box for handling the order of choices.
// Left box has the original choices
@ -122,8 +123,8 @@ public class DualListBox<T> extends FDialog {
}
});
selectOrder = add(new FLabel.Builder().align(HAlignment.CENTER).text("Select Order").build());
orderedLabel = add(new FLabel.Builder().align(HAlignment.CENTER).build());
selectOrder = add(new FLabel.Builder().align(Align.center).text("Select Order").build());
orderedLabel = add(new FLabel.Builder().align(Align.center).build());
setButtonState();
}

View File

@ -3,8 +3,10 @@ package forge.toolbox;
import org.apache.commons.lang3.StringUtils;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.graphics.g2d.BitmapFont.TextBounds;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.toolbox.TextBounds;
import forge.Graphics;
import forge.UiCommand;
@ -239,7 +241,7 @@ public class FButton extends FDisplayObject implements IButton {
if (corner == Corner.BottomLeft || corner == Corner.BottomRight) {
displayText = displayText.replaceFirst(" ", "\n"); //allow second word to wrap if corner button
}
g.drawText(displayText, font, foreColor, x, y, w, h, false, HAlignment.CENTER, true);
g.drawText(displayText, font, foreColor, x, y, w, h, false, Align.center, true);
}
}

View File

@ -1,6 +1,7 @@
package forge.toolbox;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.Graphics;
import forge.assets.FImage;
@ -21,7 +22,7 @@ public class FCheckBox extends FLabel implements ICheckBox {
this(text0, false);
}
public FCheckBox(String text0, boolean selected0) {
super(new Builder().text(text0).align(HAlignment.LEFT).selectable().selected(selected0));
super(new Builder().text(text0).align(Align.left).selectable().selected(selected0));
setIcon(new CheckBoxIcon());
}

View File

@ -4,7 +4,8 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.Graphics;
import forge.assets.FSkin;
@ -338,7 +339,7 @@ public class FChoiceList<T> extends FList<T> implements ActivateHandler {
@Override
public void drawValue(Graphics g, T value, FSkinFont font, FSkinColor foreColor, boolean pressed, float x, float y, float w, float h) {
g.drawText(getChoiceText(value), font, foreColor, x, y, w, h, allowDefaultItemWrap(), HAlignment.LEFT, true);
g.drawText(getChoiceText(value), font, foreColor, x, y, w, h, allowDefaultItemWrap(), Align.left, true);
}
}
protected class NumberRenderer extends DefaultItemRenderer {
@ -365,7 +366,7 @@ public class FChoiceList<T> extends FList<T> implements ActivateHandler {
@Override
public void drawValue(Graphics g, T value, FSkinFont font, FSkinColor foreColor, boolean pressed, float x, float y, float w, float h) {
g.drawText(getChoiceText(value), font, foreColor, x, y, w, h, false, HAlignment.CENTER, true);
g.drawText(getChoiceText(value), font, foreColor, x, y, w, h, false, Align.center, true);
}
}
//special renderer for cards
@ -484,7 +485,7 @@ public class FChoiceList<T> extends FList<T> implements ActivateHandler {
float dx = VStack.CARD_WIDTH + FList.PADDING;
x += dx;
w -= dx;
textRenderer.drawText(g, value.toString(), font, foreColor, x, y, w, h, y, h, true, HAlignment.LEFT, true);
textRenderer.drawText(g, value.toString(), font, foreColor, x, y, w, h, y, h, true, Align.left, true);
}
}
protected class PlayerItemRenderer extends ItemRenderer {
@ -514,7 +515,7 @@ public class FChoiceList<T> extends FList<T> implements ActivateHandler {
g.drawImage(MatchController.getPlayerAvatar(player), x - FList.PADDING, y - FList.PADDING, VAvatar.WIDTH, VAvatar.HEIGHT);
x += VAvatar.WIDTH;
w -= VAvatar.WIDTH;
g.drawText(player.getName() + " (" + player.getLife() + ")", font, foreColor, x, y, w, h, false, HAlignment.LEFT, true);
g.drawText(player.getName() + " (" + player.getLife() + ")", font, foreColor, x, y, w, h, false, Align.left, true);
}
}
protected class IHasSkinPropRenderer extends DefaultItemRenderer {
@ -533,7 +534,7 @@ public class FChoiceList<T> extends FList<T> implements ActivateHandler {
x += dx;
w -= dx;
}
textRenderer.drawText(g, value.toString(), font, foreColor, x, y, w, h, y, h, true, HAlignment.LEFT, true);
textRenderer.drawText(g, value.toString(), font, foreColor, x, y, w, h, y, h, true, Align.left, true);
}
}

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.Graphics;
import forge.interfaces.IComboBox;
@ -223,7 +224,7 @@ public class FComboBox<T> extends FTextField implements IComboBox<T> {
@Override
protected float getLeftPadding() {
if (getAlignment() == HAlignment.CENTER) {
if (getAlignment() == Align.center) {
return getRightPadding(); //match right padding if center aligned
}
return super.getLeftPadding();

View File

@ -1,7 +1,8 @@
package forge.toolbox;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Align;
import forge.Forge;
import forge.Graphics;
@ -225,7 +226,7 @@ public abstract class FDialog extends FOverlay {
if (btnMiddle != null && !title.isEmpty()) { //render title above prompt if middle button present
y -= MSG_HEIGHT;
g.fillRect(VPrompt.BACK_COLOR, 0, y, w, MSG_HEIGHT);
g.drawText(title, VPrompt.FONT, VPrompt.FORE_COLOR, 0, y, w, MSG_HEIGHT, false, HAlignment.CENTER, true);
g.drawText(title, VPrompt.FONT, VPrompt.FORE_COLOR, 0, y, w, MSG_HEIGHT, false, Align.center, true);
}
g.drawLine(BORDER_THICKNESS, BORDER_COLOR, 0, y, w, y);
}

View File

@ -7,6 +7,7 @@ import org.apache.commons.lang3.StringUtils;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.Forge;
import forge.Graphics;
@ -397,7 +398,7 @@ public class FFileChooser extends FDialog {
g.drawImage(FSkinImage.FOLDER, x, y + (h - iconSize) / 2, iconSize, iconSize);
x += iconSize + FList.PADDING;
}
g.drawText(value.getName(), font, foreColor, x, y, w, h, false, HAlignment.LEFT, true);
g.drawText(value.getName(), font, foreColor, x, y, w, h, false, Align.left, true);
}
});
}

View File

@ -1,6 +1,7 @@
package forge.toolbox;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.Graphics;
import forge.assets.FSkinColor;
@ -32,7 +33,7 @@ public abstract class FGroupBox extends FContainer {
g.drawLine(BORDER_THICKNESS, FORE_COLOR, w, h, w, y); //draw right border
//draw caption
g.drawText(caption, FONT, FORE_COLOR, x, 0, w - x - PADDING, h, false, HAlignment.LEFT, false);
g.drawText(caption, FONT, FORE_COLOR, x, 0, w - x - PADDING, h, false, Align.left, false);
//draw border left of caption
g.drawLine(BORDER_THICKNESS, FORE_COLOR, 0, y, x, y);

View File

@ -25,7 +25,7 @@ public class FLabel extends FDisplayObject implements IButton {
private float bldIconScaleFactor = 0.8f;
private FSkinFont bldFont = FSkinFont.get(14);
private float bldAlphaComposite = 0.7f;
private Align bldAlignment = Align.LEFT;
private int bldAlignment = Align.left;
private Vector2 bldInsets = new Vector2(DEFAULT_INSETS, DEFAULT_INSETS);
private boolean bldSelectable = false;
@ -48,7 +48,7 @@ public class FLabel extends FDisplayObject implements IButton {
// Begin builder methods.
public Builder text(final String s0) { this.bldText = s0; return this; }
public Builder icon(final FImage i0) { this.bldIcon = i0; return this; }
public Builder align(final Align a0) { this.bldAlignment = a0; return this; }
public Builder align(final int a0) { this.bldAlignment = a0; return this; }
public Builder insets(final Vector2 v0) { this.bldInsets = v0; return this; }
public Builder opaque(final boolean b0) { this.bldOpaque = b0; return this; }
public Builder opaque() { opaque(true); return this; }
@ -75,7 +75,7 @@ public class FLabel extends FDisplayObject implements IButton {
public static class ButtonBuilder extends Builder {
public ButtonBuilder() {
opaque();
align(HAlignment.CENTER);
align(Align.center);
}
}
@ -103,7 +103,7 @@ public class FLabel extends FDisplayObject implements IButton {
private float iconScaleFactor;
private FSkinFont font;
private float alphaComposite;
private Align alignment;
private int alignment;
private Vector2 insets;
private boolean selectable, selected, opaque, iconInBackground, iconScaleAuto, iconScaleWithFont, pressed;
@ -186,10 +186,10 @@ public class FLabel extends FDisplayObject implements IButton {
insets = insets0;
}
public Align getAlignment() {
public int getAlignment() {
return alignment;
}
public void setAlignment(final Align alignment0) {
public void setAlignment(final int alignment0) {
alignment = alignment0;
}
@ -392,7 +392,7 @@ public class FLabel extends FDisplayObject implements IButton {
}
}
private void drawText(Graphics g, float x, float y, float w, float h, Align align) {
private void drawText(Graphics g, float x, float y, float w, float h, int align) {
g.startClip(x, y, w, h);
if (textRenderer == null) {
g.drawText(text, font, textColor, x, y, w, h, false, align, true);

View File

@ -5,6 +5,7 @@ import java.util.Iterator;
import java.util.List;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.Graphics;
import forge.assets.FSkinColor;
@ -321,7 +322,7 @@ public class FList<T> extends FScrollPane implements Iterable<T> {
@Override
public void drawValue(Graphics g, Integer index, V value, FSkinFont font, FSkinColor foreColor, FSkinColor backColor, boolean pressed, float x, float y, float w, float h) {
g.drawText(value.toString(), font, foreColor, x, y, w, h, false, HAlignment.LEFT, true);
g.drawText(value.toString(), font, foreColor, x, y, w, h, false, Align.left, true);
}
}

View File

@ -1,16 +1,17 @@
package forge.toolbox;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
public class FNumericTextField extends FTextField {
private int value;
public FNumericTextField() {
setAlignment(HAlignment.RIGHT);
setAlignment(Align.right);
}
public FNumericTextField(int value0) {
setAlignment(HAlignment.RIGHT);
setAlignment(Align.right);
setValue(value0);
}

View File

@ -5,8 +5,9 @@ import java.util.List;
import org.apache.commons.lang3.StringUtils;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Align;
import com.google.common.collect.ImmutableList;
import forge.Forge;
@ -239,7 +240,7 @@ public class FOptionPane extends FDialog {
centerIcon = icon.getWidth() >= 100; //for large icon, center in dialog
lblIcon = add(new FLabel.Builder().icon(icon).iconScaleFactor(1).insets(new Vector2(0, 0)).iconInBackground(centerIcon).build());
if (centerIcon) {
lblIcon.setAlignment(HAlignment.CENTER);
lblIcon.setAlignment(Align.center);
}
}
else {
@ -251,7 +252,7 @@ public class FOptionPane extends FDialog {
prompt = add(new FTextArea(true, message));
prompt.setFont(messageFont != null ? messageFont : FSkinFont.get(12));
if (centerIcon || centerPrompt()) {
prompt.setAlignment(HAlignment.CENTER);
prompt.setAlignment(Align.center);
}
}
else {

View File

@ -1,7 +1,9 @@
package forge.toolbox;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.Graphics;
import forge.assets.FSkinFont;
import forge.interfaces.IProgressBar;
@ -161,13 +163,13 @@ public class FProgressBar extends FDisplayObject implements IProgressBar {
MSG_FONT = FSkinFont.get(11);
}
g.drawText(message, MSG_FONT, FORE_COLOR, 0, 0, w, h, false, HAlignment.CENTER, true);
g.drawText(message, MSG_FONT, FORE_COLOR, 0, 0, w, h, false, Align.center, true);
//draw text using selection fore color in needed regions over top of regular text using clipping
if (!SEL_FORE_COLOR.equals(FORE_COLOR)) {
for (Pair<Float, Float> region : selTextRegions) {
g.startClip(region.getLeft(), 0, region.getRight(), h);
g.drawText(message, MSG_FONT, SEL_FORE_COLOR, 0, 0, w, h, false, HAlignment.CENTER, true);
g.drawText(message, MSG_FONT, SEL_FORE_COLOR, 0, 0, w, h, false, Align.center, true);
g.endClip();
}
}

View File

@ -3,7 +3,8 @@ package forge.toolbox;
import java.util.ArrayList;
import java.util.List;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.Graphics;
import forge.assets.FImage;
@ -25,7 +26,7 @@ public class FRadioButton extends FLabel {
this(text0, false);
}
public FRadioButton(String text0, boolean selected0) {
super(new Builder().text(text0).align(HAlignment.LEFT).selectable().selected(selected0));
super(new Builder().text(text0).align(Align.left).selectable().selected(selected0));
setIcon(new RadioButtonIcon());
}

View File

@ -1,7 +1,8 @@
package forge.toolbox;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Align;
import forge.Graphics;
import forge.assets.FSkinColor;
@ -11,7 +12,7 @@ import forge.assets.TextRenderer;
public class FTextArea extends FScrollPane {
private String text;
private FSkinFont font;
private HAlignment alignment;
private int alignment;
private Vector2 insets;
private FSkinColor textColor;
private final TextRenderer renderer;
@ -23,7 +24,7 @@ public class FTextArea extends FScrollPane {
public FTextArea(boolean parseReminderText0, String text0) {
text = text0;
font = FSkinFont.get(14);
alignment = HAlignment.LEFT;
alignment = Align.left;
insets = new Vector2(1, 1); //prevent text getting cut off by clip
textColor = FLabel.DEFAULT_TEXT_COLOR;
renderer = new TextRenderer(parseReminderText0);
@ -37,10 +38,10 @@ public class FTextArea extends FScrollPane {
revalidate();
}
public HAlignment getAlignment() {
public int getAlignment() {
return alignment;
}
public void setAlignment(HAlignment alignment0) {
public void setAlignment(int alignment0) {
alignment = alignment0;
}

View File

@ -2,6 +2,7 @@ package forge.toolbox;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.Forge;
import forge.Forge.KeyInputAdapter;
@ -35,7 +36,7 @@ public class FTextField extends FDisplayObject implements ITextField {
private String text, ghostText, textBeforeKeyInput;
protected FSkinFont font, renderedFont;
private HAlignment alignment;
private int alignment;
private int selStart, selLength;
private boolean isEditing, readOnly;
@ -81,7 +82,7 @@ public class FTextField extends FDisplayObject implements ITextField {
text = text0;
ghostText = "";
setFont(DEFAULT_FONT);
alignment = HAlignment.LEFT;
alignment = Align.left;
}
public String getText() {
@ -131,10 +132,10 @@ public class FTextField extends FDisplayObject implements ITextField {
return text.isEmpty();
}
public HAlignment getAlignment() {
public int getAlignment() {
return alignment;
}
public void setAlignment(HAlignment alignment0) {
public void setAlignment(int alignment0) {
alignment = alignment0;
}
@ -433,12 +434,12 @@ public class FTextField extends FDisplayObject implements ITextField {
protected float getTextLeft() {
switch (alignment) {
case LEFT:
case Align.left:
default:
return getLeftPadding();
case CENTER:
case Align.center:
return getLeftPadding() + (getWidth() - getRightPadding() - getLeftPadding() - renderedFont.getBounds(text).width) / 2;
case RIGHT:
case Align.right:
return getWidth() - getRightPadding() - renderedFont.getBounds(text).width;
}
}

View File

@ -1,6 +1,7 @@
package forge.toolbox;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.Align;
import forge.Graphics;
import forge.assets.FSkinColor;
@ -167,6 +168,6 @@ public class FToggleSwitch extends FDisplayObject {
x += PADDING;
w -= 2 * PADDING;
g.drawText(text, font, FORE_COLOR, x, y, w, h, false, HAlignment.CENTER, true);
g.drawText(text, font, FORE_COLOR, x, y, w, h, false, Align.center, true);
}
}

View File

@ -0,0 +1,30 @@
package forge.toolbox;
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
/**
* Created by Relintai on 2017. 10. 06..
*/
public class TextBounds {
public float width;
public float height;
public TextBounds () {
}
public TextBounds (TextBounds bounds) {
set(bounds);
}
public void set (TextBounds bounds) {
width = bounds.width;
height = bounds.height;
}
public void set (GlyphLayout glyphLayout) {
width = glyphLayout.width;
height = glyphLayout.height;
}
}