Merge remote-tracking branch 'upstream/master'
@@ -95,7 +95,7 @@ public class ComputerUtil {
|
||||
sa.setHostCard(game.getAction().moveToStack(source, sa));
|
||||
}
|
||||
|
||||
if (sa.isCopied()) {
|
||||
if (!sa.isCopied()) {
|
||||
sa.resetPaidHash();
|
||||
}
|
||||
|
||||
|
||||
@@ -163,6 +163,10 @@ public final class ImageKeys {
|
||||
for (String ext : FILE_EXTENSIONS) {
|
||||
File file = new File(dir, filename + ext);
|
||||
if (file.exists()) {
|
||||
if (file.isDirectory()) {
|
||||
file.delete();
|
||||
continue;
|
||||
}
|
||||
return file;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,6 +292,7 @@ public class AnimateEffect extends AnimateEffectBase {
|
||||
addedStaticAbilities, timestamp);
|
||||
|
||||
c.removeChangedName(timestamp);
|
||||
c.updateStateForView();
|
||||
|
||||
game.fireEvent(new GameEventCardStatsChanged(c));
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ public abstract class AnimateEffectBase extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
if (sa.hasParam("RemoveLandTypes")) {
|
||||
removeCreatureTypes = true;
|
||||
removeLandTypes = true;
|
||||
}
|
||||
if (sa.hasParam("RemoveCreatureTypes")) {
|
||||
removeCreatureTypes = true;
|
||||
|
||||
@@ -874,6 +874,15 @@ public class CardProperty {
|
||||
}
|
||||
}
|
||||
return false;
|
||||
case "TriggeredCard":
|
||||
final Object triggeringObject = source.getTriggeringObject(restriction.substring("Triggered".length()));
|
||||
if (!(triggeringObject instanceof Card)) {
|
||||
return false;
|
||||
}
|
||||
if (card.sharesCardTypeWith((Card) triggeringObject)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case "EachTopLibrary":
|
||||
final CardCollection cards = new CardCollection();
|
||||
for (Player p : game.getPlayers()) {
|
||||
@@ -1067,34 +1076,6 @@ public class CardProperty {
|
||||
if (p == null || !controller.equals(game.getNextPlayerAfter(p, direction))) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("sharesTypeWith")) {
|
||||
if (property.equals("sharesTypeWith")) {
|
||||
if (!card.sharesTypeWith(source)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
final String restriction = property.split("sharesTypeWith ")[1];
|
||||
final Card checkCard;
|
||||
if (restriction.startsWith("Triggered")) {
|
||||
final Object triggeringObject = source.getTriggeringObject(restriction.substring("Triggered".length()));
|
||||
if (!(triggeringObject instanceof Card)) {
|
||||
return false;
|
||||
}
|
||||
checkCard = (Card) triggeringObject;
|
||||
} else if (restriction.startsWith("Remembered")) {
|
||||
final Object rememberedObject = source.getFirstRemembered();
|
||||
if (!(rememberedObject instanceof Card)) {
|
||||
return false;
|
||||
}
|
||||
checkCard = (Card) rememberedObject;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!card.sharesTypeWith(checkCard)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if (property.startsWith("hasKeyword")) {
|
||||
// "withFlash" would find Flashback cards, add this to fix Mystical Teachings
|
||||
if (!card.hasKeyword(property.substring(10))) {
|
||||
|
||||
@@ -83,6 +83,7 @@ public enum TriggerType {
|
||||
SetInMotion(TriggerSetInMotion.class),
|
||||
Shuffled(TriggerShuffled.class),
|
||||
SpellAbilityCast(TriggerSpellAbilityCast.class),
|
||||
SpellAbilityCopy(TriggerSpellAbilityCopy.class),
|
||||
SpellCast(TriggerSpellAbilityCast.class),
|
||||
SpellCopy(TriggerSpellAbilityCopy.class),
|
||||
Surveil(TriggerSurveil.class),
|
||||
|
||||
@@ -334,6 +334,7 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
|
||||
if (sp.isSpell()) {
|
||||
game.getTriggerHandler().runTrigger(TriggerType.SpellCopy, runParams, false);
|
||||
}
|
||||
game.getTriggerHandler().runTrigger(TriggerType.SpellAbilityCopy, runParams, false);
|
||||
}
|
||||
|
||||
// Run BecomesTarget triggers
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<uses-sdk
|
||||
android:minSdkVersion="19"
|
||||
android:targetSdkVersion="21" />
|
||||
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
@@ -14,13 +15,14 @@
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:label="@string/app_name"
|
||||
android:largeHeap="true">
|
||||
<activity
|
||||
android:name=".Main"
|
||||
android:label="@string/app_name">
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="keyboard|keyboardHidden|navigation|orientation|screenSize|screenLayout">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
<dependency>
|
||||
<groupId>com.badlogicgames.gdx</groupId>
|
||||
<artifactId>gdx-backend-android</artifactId>
|
||||
<version>1.5.5</version>
|
||||
<version>1.9.10</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
5
forge-gui-android/res/mipmap-anydpi-v26/ic_launcher.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
BIN
forge-gui-android/res/mipmap-hdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
forge-gui-android/res/mipmap-hdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
forge-gui-android/res/mipmap-hdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
forge-gui-android/res/mipmap-ldpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
forge-gui-android/res/mipmap-mdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
forge-gui-android/res/mipmap-mdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
forge-gui-android/res/mipmap-mdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
forge-gui-android/res/mipmap-xhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
forge-gui-android/res/mipmap-xhdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 7.8 KiB |
BIN
forge-gui-android/res/mipmap-xhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
forge-gui-android/res/mipmap-xxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
BIN
forge-gui-android/res/mipmap-xxhdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
forge-gui-android/res/mipmap-xxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
forge-gui-android/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 9.5 KiB |
BIN
forge-gui-android/res/mipmap-xxxhdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
forge-gui-android/res/mipmap-xxxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
4
forge-gui-android/res/values/ic_launcher_background.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#f0f0f0</color>
|
||||
</resources>
|
||||
@@ -17,6 +17,8 @@ import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.PowerManager;
|
||||
import android.provider.Settings;
|
||||
import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
|
||||
import android.view.WindowManager;
|
||||
import android.webkit.MimeTypeMap;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
@@ -35,6 +37,8 @@ import java.io.OutputStream;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
public class Main extends AndroidApplication {
|
||||
public int time = -2;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -235,13 +239,17 @@ public class Main extends AndroidApplication {
|
||||
|
||||
@Override
|
||||
public void preventSystemSleep(final boolean preventSleep) {
|
||||
if (time == -2)
|
||||
time = Settings.System.getInt(getContentResolver(), SCREEN_OFF_TIMEOUT, 0);
|
||||
FThreads.invokeInEdtNowOrLater(new Runnable() { //must set window flags from EDT thread
|
||||
@Override
|
||||
public void run() {
|
||||
if (preventSleep) {
|
||||
Settings.System.putInt(getContentResolver(), SCREEN_OFF_TIMEOUT, Integer.MAX_VALUE);
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
}
|
||||
else {
|
||||
Settings.System.putInt(getContentResolver(), SCREEN_OFF_TIMEOUT, time);
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,13 @@ final class ImageLoader extends CacheLoader<String, BufferedImage> {
|
||||
public BufferedImage load(String key) {
|
||||
File file = ImageKeys.getImageFile(key);
|
||||
if (file != null) {
|
||||
if (!file.exists()) {
|
||||
return null;
|
||||
}
|
||||
if (file.isDirectory()) {
|
||||
file.delete();
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return ImageIO.read(file);
|
||||
}
|
||||
|
||||
@@ -28,18 +28,35 @@ public class SwingImageFetcher extends ImageFetcher {
|
||||
private void doFetch(String urlToDownload) throws IOException {
|
||||
URL url = new URL(urlToDownload);
|
||||
System.out.println("Attempting to fetch: " + url);
|
||||
java.net.URLConnection c = url.openConnection();
|
||||
c.setRequestProperty("User-Agent", "");
|
||||
BufferedImage image = ImageIO.read(c.getInputStream());
|
||||
BufferedImage image = ImageIO.read(url);
|
||||
// First, save to a temporary file so that nothing tries to read
|
||||
// a partial download.
|
||||
File destFile = new File(destPath + ".tmp");
|
||||
destFile.mkdirs();
|
||||
ImageIO.write(image, "jpg", destFile);
|
||||
// Now, rename it to the correct name.
|
||||
destFile.renameTo(new File(destPath));
|
||||
System.out.println("Saved image to " + destPath);
|
||||
SwingUtilities.invokeLater(notifyObservers);
|
||||
// need to check directory folder for mkdir
|
||||
destFile.getParentFile().mkdirs();
|
||||
if (ImageIO.write(image, "jpg", destFile)) {
|
||||
// Now, rename it to the correct name.
|
||||
if (destFile.renameTo(new File(destPath))) {
|
||||
System.out.println("Saved image to " + destPath);
|
||||
SwingUtilities.invokeLater(notifyObservers);
|
||||
} else {
|
||||
System.err.println("Failed to rename image to " + destPath);
|
||||
}
|
||||
} else {
|
||||
System.err.println("Failed to save image from " + url + " as jpeg");
|
||||
// try to save image as png instead
|
||||
if (ImageIO.write(image, "png", destFile)) {
|
||||
String newPath = destPath.replace(".jpg", ".png");
|
||||
if (destFile.renameTo(new File(newPath))) {
|
||||
System.out.println("Saved image to " + newPath);
|
||||
SwingUtilities.invokeLater(notifyObservers);
|
||||
} else {
|
||||
System.err.println("Failed to rename image to " + newPath);
|
||||
}
|
||||
} else {
|
||||
System.err.println("Failed to save image from " + url + " as png");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void run() {
|
||||
@@ -48,7 +65,7 @@ public class SwingImageFetcher extends ImageFetcher {
|
||||
doFetch(urlToDownload);
|
||||
break;
|
||||
} catch (IOException e) {
|
||||
System.out.println("Failed to download card [" + destPath + "] image: " + e.getMessage());
|
||||
System.err.println("Failed to download card [" + destPath + "] image: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
<dependency>
|
||||
<groupId>com.badlogicgames.gdx</groupId>
|
||||
<artifactId>gdx-backend-robovm</artifactId>
|
||||
<version>1.5.5</version>
|
||||
<version>1.9.10</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
<dependency>
|
||||
<groupId>com.badlogicgames.gdx</groupId>
|
||||
<artifactId>gdx-backend-lwjgl</artifactId>
|
||||
<version>1.5.5</version>
|
||||
<version>1.9.10</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.badlogicgames.gdx</groupId>
|
||||
@@ -71,7 +71,7 @@
|
||||
<dependency>
|
||||
<groupId>com.badlogicgames.gdx</groupId>
|
||||
<artifactId>gdx-freetype-platform</artifactId>
|
||||
<version>1.5.5</version>
|
||||
<version>1.9.10</version>
|
||||
<classifier>natives-desktop</classifier>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/commons-cli/commons-cli -->
|
||||
|
||||
@@ -63,12 +63,12 @@
|
||||
<dependency>
|
||||
<groupId>com.badlogicgames.gdx</groupId>
|
||||
<artifactId>gdx</artifactId>
|
||||
<version>1.5.5</version>
|
||||
<version>1.9.10</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.badlogicgames.gdx</groupId>
|
||||
<artifactId>gdx-freetype</artifactId>
|
||||
<version>1.5.5</version>
|
||||
<version>1.9.10</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -4,8 +4,6 @@ import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.TextBounds;
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
|
||||
@@ -20,7 +18,7 @@ import forge.assets.FSkinColor;
|
||||
import forge.assets.FSkinFont;
|
||||
import forge.toolbox.FDisplayObject;
|
||||
import forge.util.Utils;
|
||||
|
||||
import forge.util.TextBounds;
|
||||
import java.util.Stack;
|
||||
|
||||
public class Graphics {
|
||||
@@ -602,10 +600,10 @@ public class Graphics {
|
||||
batch.draw(image, adjustX(x), adjustY(y, h), originX - x, h - (originY - y), w, h, 1, 1, rotation, srcX, srcY, srcWidth, srcHeight, false, false);
|
||||
}
|
||||
|
||||
public void drawText(String text, FSkinFont font, FSkinColor skinColor, float x, float y, float w, float h, boolean wrap, HAlignment horzAlignment, boolean centerVertically) {
|
||||
public void drawText(String text, FSkinFont font, FSkinColor skinColor, float x, float y, float w, float h, boolean wrap, int horzAlignment, boolean centerVertically) {
|
||||
drawText(text, font, skinColor.getColor(), x, y, w, h, wrap, horzAlignment, centerVertically);
|
||||
}
|
||||
public void drawText(String text, FSkinFont font, Color color, float x, float y, float w, float h, boolean wrap, HAlignment horzAlignment, boolean centerVertically) {
|
||||
public void drawText(String text, FSkinFont font, Color color, float x, float y, float w, float h, boolean wrap, int horzAlignment, boolean centerVertically) {
|
||||
if (alphaComposite < 1) {
|
||||
color = FSkinColor.alphaColor(color, color.a * alphaComposite);
|
||||
}
|
||||
@@ -660,7 +658,7 @@ public class Graphics {
|
||||
}
|
||||
|
||||
//use nifty trick with multiple text renders to draw outlined text
|
||||
public void drawOutlinedText(String text, FSkinFont skinFont, Color textColor, Color outlineColor, float x, float y, float w, float h, boolean wrap, HAlignment horzAlignment, boolean centerVertically) {
|
||||
public void drawOutlinedText(String text, FSkinFont skinFont, Color textColor, Color outlineColor, float x, float y, float w, float h, boolean wrap, int horzAlignment, boolean centerVertically) {
|
||||
drawText(text, skinFont, outlineColor, x - 1, y, w, h, wrap, horzAlignment, centerVertically);
|
||||
drawText(text, skinFont, outlineColor, x, y - 1, w, h, wrap, horzAlignment, centerVertically);
|
||||
drawText(text, skinFont, outlineColor, x - 1, y - 1, w, h, wrap, horzAlignment, centerVertically);
|
||||
|
||||
@@ -8,7 +8,7 @@ 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;
|
||||
|
||||
|
||||
@@ -5,13 +5,8 @@ import com.badlogic.gdx.files.FileHandle;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
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.*;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.BitmapFontData;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.TextBounds;
|
||||
import com.badlogic.gdx.graphics.g2d.PixmapPacker;
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
|
||||
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter;
|
||||
import com.badlogic.gdx.graphics.glutils.PixmapTextureData;
|
||||
@@ -19,8 +14,8 @@ import com.badlogic.gdx.utils.Array;
|
||||
import forge.FThreads;
|
||||
import forge.properties.ForgeConstants;
|
||||
import forge.util.FileUtil;
|
||||
import forge.util.TextBounds;
|
||||
import forge.util.Utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -31,6 +26,7 @@ public class FSkinFont {
|
||||
|
||||
private static final String TTF_FILE = "font1.ttf";
|
||||
private static final Map<Integer, FSkinFont> fonts = new HashMap<Integer, FSkinFont>();
|
||||
private static final GlyphLayout layout = new GlyphLayout();
|
||||
|
||||
static {
|
||||
FileUtil.ensureDirectoryExists(ForgeConstants.FONTS_DIR);
|
||||
@@ -98,15 +94,22 @@ 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);
|
||||
layout.setText(font, str);
|
||||
return new TextBounds(layout.width, layout.height);
|
||||
|
||||
}
|
||||
public TextBounds getMultiLineBounds(CharSequence str) {
|
||||
updateScale();
|
||||
return font.getMultiLineBounds(str);
|
||||
layout.setText(font, str);
|
||||
return new TextBounds(layout.width, layout.height);
|
||||
|
||||
}
|
||||
public TextBounds getWrappedBounds(CharSequence str, float wrapWidth) {
|
||||
updateScale();
|
||||
return font.getWrappedBounds(str, wrapWidth);
|
||||
layout.setText(font, str);
|
||||
layout.width = wrapWidth;
|
||||
return new TextBounds(layout.width, layout.height);
|
||||
|
||||
}
|
||||
public float getAscent() {
|
||||
updateScale();
|
||||
@@ -121,20 +124,16 @@ 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 horzAlignment) {
|
||||
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, horzAlignment, wrap);
|
||||
}
|
||||
|
||||
//update scale of font if needed
|
||||
private void updateScale() {
|
||||
if (font.getScaleX() != scale) {
|
||||
font.setScale(scale);
|
||||
font.getData().setScale(scale);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,7 +186,7 @@ public class FSkinFont {
|
||||
|
||||
//only generate images for characters that could be used by Forge
|
||||
String chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890\"!?'.,;:()[]{}<>|/@\\^$-%+=#_&*\u2014\u2022";
|
||||
|
||||
chars += "ÁÉÍÓÚáéíóúÀÈÌÒÙàèìòùÑñÄËÏÖÜäëïöüẞß";
|
||||
final PixmapPacker packer = new PixmapPacker(pageSize, pageSize, Pixmap.Format.RGBA8888, 2, false);
|
||||
final FreeTypeFontParameter parameter = new FreeTypeFontParameter();
|
||||
parameter.characters = chars;
|
||||
@@ -200,7 +199,7 @@ public class FSkinFont {
|
||||
FThreads.invokeInEdtNowOrLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
TextureRegion[] textureRegions = new TextureRegion[pages.size];
|
||||
Array<TextureRegion> textureRegions = new Array<>();
|
||||
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 +210,7 @@ public class FSkinFont {
|
||||
}
|
||||
};
|
||||
texture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
|
||||
textureRegions[i] = new TextureRegion(texture);
|
||||
textureRegions.addAll(new TextureRegion(texture));
|
||||
}
|
||||
|
||||
font = new BitmapFont(fontData, textureRegions, true);
|
||||
|
||||
@@ -6,14 +6,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.TextBounds;
|
||||
|
||||
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.util.TextBounds;
|
||||
|
||||
//Encodes text for drawing with symbols and reminder text
|
||||
public class TextRenderer {
|
||||
@@ -528,10 +527,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) {
|
||||
public void drawText(Graphics g, String text, FSkinFont skinFont, FSkinColor skinColor, float x, float y, float w, float h, float visibleStartY, float visibleHeight, boolean wrap0, int horzAlignment, boolean centerVertically) {
|
||||
drawText(g, text, skinFont, skinColor.getColor(), x, y, w, h, visibleStartY, visibleHeight, wrap0, horzAlignment, centerVertically);
|
||||
}
|
||||
public void drawText(Graphics g, String text, FSkinFont skinFont, Color color, float x, float y, float w, float h, float visibleStartY, float visibleHeight, boolean wrap0, HAlignment horzAlignment, boolean centerVertically) {
|
||||
public void drawText(Graphics g, String text, FSkinFont skinFont, Color color, float x, float y, float w, float h, float visibleStartY, float visibleHeight, boolean wrap0, int horzAlignment, boolean centerVertically) {
|
||||
setProps(text, skinFont, w, h, wrap0);
|
||||
if (needClip) { //prevent text flowing outside region if couldn't shrink it to fit
|
||||
g.startClip(x, y, w, h);
|
||||
@@ -542,13 +541,13 @@ public class TextRenderer {
|
||||
float[] alignmentOffsets = new float[lineWidths.size()];
|
||||
for (int i = 0; i < lineWidths.size(); i++) {
|
||||
switch (horzAlignment) {
|
||||
case LEFT:
|
||||
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;
|
||||
}
|
||||
@@ -603,7 +602,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ 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.utils.Align;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import forge.Graphics;
|
||||
import forge.assets.*;
|
||||
@@ -175,7 +175,7 @@ public class CardImageRenderer {
|
||||
CardFaceSymbols.drawManaCost(g, otherManaCost, x + w - manaCostWidth, y + (h - MANA_SYMBOL_SIZE) / 2, MANA_SYMBOL_SIZE);
|
||||
//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 +183,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 +221,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 +268,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 +313,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 +451,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 +460,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 +478,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 +491,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 +513,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package forge.card;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
|
||||
import forge.item.PaperCard;
|
||||
@@ -14,7 +14,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,13 +7,13 @@ import com.badlogic.gdx.graphics.GL20;
|
||||
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.HAlignment;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.TextBounds;
|
||||
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.CachedCardImage;
|
||||
import forge.FThreads;
|
||||
@@ -40,7 +40,7 @@ import forge.screens.match.MatchController;
|
||||
import forge.toolbox.FList;
|
||||
import forge.util.Utils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import forge.util.TextBounds;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -95,6 +95,7 @@ public class CardRenderer {
|
||||
private static Map<Integer, BitmapFont> counterFonts = new HashMap<>();
|
||||
private static final Color counterBackgroundColor = new Color(0f, 0f, 0f, 0.9f);
|
||||
private static final Map<CounterType, Color> counterColorCache = new HashMap<>();
|
||||
private static final GlyphLayout layout = new GlyphLayout();
|
||||
|
||||
static {
|
||||
try {
|
||||
@@ -261,7 +262,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,7 +311,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);
|
||||
@@ -323,7 +324,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
|
||||
@@ -350,7 +351,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) {
|
||||
@@ -379,7 +380,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) {
|
||||
@@ -447,7 +448,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;
|
||||
@@ -476,7 +477,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()) {
|
||||
@@ -556,7 +557,11 @@ public class CardRenderer {
|
||||
maxCounters = Math.max(maxCounters, numberOfCounters);
|
||||
}
|
||||
|
||||
if (counterBoxBaseWidth + font.getBounds(String.valueOf(maxCounters)).width > w) {
|
||||
//if (counterBoxBaseWidth + font.getBounds(String.valueOf(maxCounters)).width > w) {
|
||||
layout.setText(font, String.valueOf(maxCounters));
|
||||
|
||||
if (counterBoxBaseWidth + layout.width > w) {
|
||||
|
||||
drawCounterImage(card, g, x, y, w, h);
|
||||
return;
|
||||
}
|
||||
@@ -567,7 +572,9 @@ public class CardRenderer {
|
||||
|
||||
final CounterType counter = counterEntry.getKey();
|
||||
final int numberOfCounters = counterEntry.getValue();
|
||||
final float counterBoxRealWidth = counterBoxBaseWidth + font.getBounds(String.valueOf(numberOfCounters)).width + 4;
|
||||
//final float counterBoxRealWidth = counterBoxBaseWidth + font.getBounds(String.valueOf(numberOfCounters)).width + 4;
|
||||
layout.setText(font, String.valueOf(numberOfCounters));
|
||||
final float counterBoxRealWidth = counterBoxBaseWidth + layout.width + 4;
|
||||
|
||||
final float counterYOffset = spaceFromTopOfCard - (currentCounter++ * (counterBoxHeight + counterBoxSpacing));
|
||||
|
||||
@@ -579,8 +586,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);
|
||||
|
||||
}
|
||||
|
||||
@@ -588,13 +595,14 @@ 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 horizontalAlignment) {
|
||||
|
||||
if (color.a < 1) { //enable blending so alpha colored shapes work properly
|
||||
Gdx.gl.glEnable(GL_BLEND);
|
||||
}
|
||||
|
||||
TextBounds textBounds = font.getMultiLineBounds(text);
|
||||
layout.setText(font, text);
|
||||
TextBounds textBounds = new TextBounds(layout.width, layout.height);
|
||||
|
||||
float textHeight = textBounds.height;
|
||||
if (h > textHeight) {
|
||||
@@ -602,7 +610,7 @@ public class CardRenderer {
|
||||
}
|
||||
|
||||
font.setColor(color);
|
||||
font.drawMultiLine(g.getBatch(), text, g.adjustX(x), g.adjustY(y, 0), w, horizontalAlignment);
|
||||
font.draw(g.getBatch(), text, g.adjustX(x), g.adjustY(y, 0), w, horizontalAlignment, true);
|
||||
|
||||
if (color.a < 1) {
|
||||
Gdx.gl.glDisable(GL_BLEND);
|
||||
@@ -685,7 +693,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);
|
||||
@@ -693,7 +701,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);
|
||||
}
|
||||
}
|
||||
@@ -771,7 +779,8 @@ public class CardRenderer {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
TextureRegion[] textureRegions = new TextureRegion[pages.size];
|
||||
//TextureRegion[] textureRegions = new TextureRegion[pages.size];
|
||||
Array<TextureRegion> textureRegions = new Array<>();
|
||||
for (int i = 0; i < pages.size; i++) {
|
||||
PixmapPacker.Page p = pages.get(i);
|
||||
Texture texture = new Texture(new PixmapTextureData(p.getPixmap(), p.getPixmap().getFormat(), false, false)) {
|
||||
@@ -782,7 +791,8 @@ public class CardRenderer {
|
||||
}
|
||||
};
|
||||
texture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
|
||||
textureRegions[i] = new TextureRegion(texture);
|
||||
//textureRegions[i] = new TextureRegion(texture);
|
||||
textureRegions.add(new TextureRegion(texture));
|
||||
}
|
||||
|
||||
counterFonts.put(fontSize, new BitmapFont(fontData, textureRegions, true));
|
||||
|
||||
@@ -5,8 +5,8 @@ import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
import com.badlogic.gdx.math.Rectangle;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
|
||||
import forge.Forge;
|
||||
import forge.Graphics;
|
||||
@@ -281,10 +281,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
|
||||
|
||||
@@ -48,7 +48,7 @@ import forge.toolbox.FTextArea;
|
||||
import forge.util.Callback;
|
||||
import forge.util.Utils;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -122,7 +122,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 +322,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) {
|
||||
|
||||
@@ -41,7 +41,7 @@ import forge.util.storage.IStorage;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -524,7 +524,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
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package forge.deck;
|
||||
|
||||
import com.badlogic.gdx.Input.Keys;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
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;
|
||||
@@ -239,8 +239,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);
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package forge.error;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.TextBounds;
|
||||
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import forge.Forge;
|
||||
import forge.Graphics;
|
||||
import forge.assets.FSkinColor;
|
||||
@@ -15,6 +13,7 @@ import forge.toolbox.FEvent.FEventHandler;
|
||||
import forge.toolbox.FScrollPane;
|
||||
import forge.toolbox.FTextArea;
|
||||
import forge.util.Callback;
|
||||
import forge.util.TextBounds;
|
||||
import forge.util.Utils;
|
||||
|
||||
public class BugReportDialog extends FScreen { //use screen rather than dialog so screen with bug isn't rendered
|
||||
@@ -148,7 +147,7 @@ public class BugReportDialog extends FScreen { //use screen rather than dialog s
|
||||
@Override
|
||||
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
|
||||
|
||||
@@ -20,7 +20,7 @@ import forge.toolbox.FList;
|
||||
import forge.toolbox.FList.CompactModeHandler;
|
||||
import forge.util.Utils;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
|
||||
@@ -118,7 +118,7 @@ public final class DeckManager extends ItemManager<DeckProxy> implements IHasGam
|
||||
|
||||
if (DeckManager.this.getConfig().getCols().size() == 1) {
|
||||
//if just string column, just draw deck string value
|
||||
g.drawText(deck.toString(), font, foreColor, x, y, w, h, false, HAlignment.LEFT, true);
|
||||
g.drawText(deck.toString(), font, foreColor, x, y, w, h, false, Align.left, true);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -131,7 +131,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 +158,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;
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
package forge.itemmanager;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
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 +83,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();
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package forge.itemmanager;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import com.google.common.base.Function;
|
||||
|
||||
import forge.Graphics;
|
||||
@@ -67,7 +67,7 @@ public class SpellShopManager extends ItemManager<InventoryItem> {
|
||||
CardRenderer.drawCardListItem(g, font, foreColor, (PaperCard)value.getKey(), value.getValue(), getItemSuffix(value), x, y, w, h, compactModeHandler.isCompactMode());
|
||||
}
|
||||
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 +87,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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package forge.itemmanager.filters;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
@@ -97,7 +97,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 +231,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 +248,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()) {
|
||||
|
||||
@@ -24,7 +24,7 @@ import forge.util.Utils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
|
||||
|
||||
public abstract class FormatFilter<T extends InventoryItem> extends ItemFilter<T> {
|
||||
@@ -231,7 +231,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;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package forge.itemmanager.filters;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import forge.Forge;
|
||||
import forge.Graphics;
|
||||
import forge.assets.FSkinColor;
|
||||
@@ -132,7 +132,7 @@ public class HistoricFormatSelect extends FScreen {
|
||||
float textHeight = h;
|
||||
h *= 0.66f;
|
||||
|
||||
g.drawText(value.toString(), font, foreColor, x, y, w - h - FList.PADDING, textHeight, false, BitmapFont.HAlignment.LEFT, true);
|
||||
g.drawText(value.toString(), font, foreColor, x, y, w - h - FList.PADDING, textHeight, false, Align.left, true);
|
||||
|
||||
x += w - h;
|
||||
y += (textHeight - h) / 2;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package forge.itemmanager.filters;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import forge.assets.FSkinFont;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.itemmanager.ItemManager;
|
||||
@@ -60,7 +59,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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package forge.itemmanager.filters;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
|
||||
@@ -101,7 +101,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package forge.itemmanager.filters;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
|
||||
import forge.assets.FImage;
|
||||
import forge.item.InventoryItem;
|
||||
@@ -70,7 +70,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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package forge.itemmanager.filters;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
import forge.card.CardRules;
|
||||
@@ -55,7 +55,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);
|
||||
|
||||
@@ -37,9 +37,9 @@ import java.util.Map.Entry;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
import com.badlogic.gdx.math.Rectangle;
|
||||
import com.badlogic.gdx.math.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 +789,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);
|
||||
@@ -963,7 +963,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package forge.menu;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.TextBounds;
|
||||
|
||||
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.util.TextBounds;
|
||||
import forge.util.Utils;
|
||||
|
||||
public class FMagnifyView extends FDropDown {
|
||||
@@ -66,6 +65,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,10 @@ 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package forge.menu;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
|
||||
import forge.Graphics;
|
||||
import forge.assets.FSkinColor;
|
||||
@@ -99,6 +99,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package forge.menu;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.TextBounds;
|
||||
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import forge.Forge;
|
||||
import forge.Graphics;
|
||||
import forge.assets.FSkinColor;
|
||||
@@ -10,6 +8,7 @@ import forge.assets.FSkinFont;
|
||||
import forge.assets.FSkinColor.Colors;
|
||||
import forge.screens.FScreen;
|
||||
import forge.toolbox.FDisplayObject;
|
||||
import forge.util.TextBounds;
|
||||
import forge.util.Utils;
|
||||
|
||||
public class FTooltip extends FDropDown {
|
||||
@@ -68,6 +67,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ package forge.screens;
|
||||
import java.util.List;
|
||||
|
||||
import com.badlogic.gdx.Input.Keys;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
import com.badlogic.gdx.math.Rectangle;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
|
||||
import forge.Forge;
|
||||
import forge.Graphics;
|
||||
@@ -197,13 +197,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 +245,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);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package forge.screens;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
|
||||
import forge.FThreads;
|
||||
import forge.Forge;
|
||||
@@ -95,6 +95,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ 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.utils.Align;
|
||||
|
||||
import forge.Forge;
|
||||
import forge.Graphics;
|
||||
@@ -94,7 +94,7 @@ public class SplashScreen extends FContainer {
|
||||
String disclaimer = "Forge is not affiliated in any way with Wizards of the Coast.\n"
|
||||
+ "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 +103,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package forge.screens;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
|
||||
import forge.Forge;
|
||||
import forge.Graphics;
|
||||
@@ -183,7 +183,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 +365,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 +393,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;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package forge.screens.achievements;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
import com.badlogic.gdx.math.Rectangle;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
|
||||
import forge.Forge;
|
||||
import forge.Graphics;
|
||||
@@ -54,7 +54,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 +271,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 +338,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
|
||||
public class AvatarSelector extends FScreen {
|
||||
public static int getRandomAvatar(List<Integer> usedAvatars) {
|
||||
@@ -87,7 +87,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();
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import forge.deck.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
import forge.FThreads;
|
||||
@@ -413,10 +413,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,7 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
@@ -835,7 +834,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");
|
||||
|
||||
@@ -6,8 +6,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
|
||||
import forge.FThreads;
|
||||
import forge.Graphics;
|
||||
@@ -253,8 +252,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 +262,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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package forge.screens.home;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import forge.Forge;
|
||||
import forge.Graphics;
|
||||
import forge.assets.FSkinColor;
|
||||
@@ -247,7 +247,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);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package forge.screens.limited;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
|
||||
import forge.FThreads;
|
||||
import forge.Forge;
|
||||
@@ -39,7 +39,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());
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package forge.screens.limited;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import forge.FThreads;
|
||||
|
||||
import forge.Forge;
|
||||
@@ -39,7 +39,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());
|
||||
|
||||
@@ -3,6 +3,7 @@ package forge.screens.match;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import forge.properties.ForgeConstants;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.badlogic.gdx.Input.Keys;
|
||||
@@ -507,8 +508,8 @@ public class MatchScreen extends FScreen {
|
||||
float w = getWidth() - x;
|
||||
|
||||
if(FModel.getPreferences().getPrefBoolean(FPref.UI_DYNAMIC_PLANECHASE_BG)
|
||||
&& hasActivePlane())
|
||||
setPlanarBG(g, getPlaneName(), x, y, w, midField);
|
||||
&& hasActivePlane()) //TODO: scale BG to correct aspect ratio/crop center
|
||||
setPlanarBG(g, getPlaneName(), x, y, w, ForgeConstants.isGdxPortLandscape ? getHeight() : midField);
|
||||
else
|
||||
g.drawImage(FSkinTexture.BG_MATCH, x, y, w, midField + bottomPlayerPanel.getField().getHeight() - y);
|
||||
}
|
||||
@@ -880,7 +881,7 @@ public class MatchScreen extends FScreen {
|
||||
case "Mirrored Depths":
|
||||
g.drawImage(FSkinTexture.BG_PLANE77, x, y, w, midField + bottomPlayerPanel.getField().getHeight() - y);
|
||||
break;
|
||||
case "Talon_Gates":
|
||||
case "Talon Gates":
|
||||
g.drawImage(FSkinTexture.BG_PLANE78, x, y, w, midField + bottomPlayerPanel.getField().getHeight() - y);
|
||||
break;
|
||||
|
||||
|
||||