From bf36e8bd2ae56c5890041790ad36cec3330cc69f Mon Sep 17 00:00:00 2001 From: drdev Date: Thu, 27 Feb 2014 05:08:17 +0000 Subject: [PATCH] Display disclaimer on splash screen --- forge-m-base/src/forge/Forge.java | 19 ++++++++++--------- .../src/forge/screens/SplashScreen.java | 15 ++++++++++++++- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/forge-m-base/src/forge/Forge.java b/forge-m-base/src/forge/Forge.java index 212f6e8c5ad..df338a2e6b4 100644 --- a/forge-m-base/src/forge/Forge.java +++ b/forge-m-base/src/forge/Forge.java @@ -3,6 +3,8 @@ package forge; import java.util.ArrayList; import java.util.Stack; +import javax.swing.GroupLayout.Alignment; + import com.badlogic.gdx.ApplicationListener; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Color; @@ -397,26 +399,25 @@ public class Forge implements ApplicationListener { } public void drawText(String text, FSkinFont skinFont, FSkinColor skinColor, float x, float y, float w, float h, boolean wrap, HAlignment horzAlignment, boolean centerVertically) { - BitmapFont font = skinFont.getFont(); - font.setColor(skinColor.getColor()); + drawText(text, skinFont.getFont(), skinColor.getColor(), x, y, w, h, wrap, horzAlignment, centerVertically); + } + public void drawText(String text, FSkinFont skinFont, Color color, float x, float y, float w, float h, boolean wrap, HAlignment horzAlignment, boolean centerVertically) { + drawText(text, skinFont.getFont(), color, x, y, w, h, wrap, horzAlignment, centerVertically); + } + public void drawText(String text, BitmapFont font, Color color, float x, float y, float w, float h, boolean wrap, HAlignment horzAlignment, boolean centerVertically) { + font.setColor(color); if (wrap) { float textHeight = font.getWrappedBounds(text, w).height; if (h > textHeight && centerVertically) { y += (h - textHeight) / 2; } - else if (h == 0) { - h = textHeight; - } - font.drawWrapped(batch, text, adjustX(x), adjustY(y, h), w, horzAlignment); + font.drawWrapped(batch, text, adjustX(x), adjustY(y, 0), w, horzAlignment); } else { float textHeight = font.getMultiLineBounds(text).height; if (h > textHeight && centerVertically) { y += (h - textHeight) / 2; } - else if (h == 0) { - h = textHeight; - } font.drawMultiLine(batch, text, adjustX(x), adjustY(y, 0), w, horzAlignment); } } diff --git a/forge-m-base/src/forge/screens/SplashScreen.java b/forge-m-base/src/forge/screens/SplashScreen.java index 3ec8139a6c8..33d077d08c8 100644 --- a/forge-m-base/src/forge/screens/SplashScreen.java +++ b/forge-m-base/src/forge/screens/SplashScreen.java @@ -1,13 +1,17 @@ package forge.screens; import com.badlogic.gdx.graphics.g2d.TextureRegion; +import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; + import forge.Forge.Graphics; +import forge.assets.FSkinFont; import forge.toolbox.FContainer; import forge.toolbox.FProgressBar; public class SplashScreen extends FContainer { private TextureRegion background; private final FProgressBar progressBar; + private FSkinFont disclaimerFont; public SplashScreen() { progressBar = add(new FProgressBar()); @@ -29,7 +33,7 @@ public class SplashScreen extends FContainer { protected void drawBackground(Graphics g) { if (background == null) { return; } - g.fillRect(FProgressBar.BACK_COLOR, 0, 0, getWidth(), getHeight()); + g.fillRect(FProgressBar.SEL_BACK_COLOR, 0, 0, getWidth(), getHeight()); float x, y, w, h; float backgroundRatio = background.getRegionWidth() / background.getRegionHeight(); @@ -47,5 +51,14 @@ public class SplashScreen extends FContainer { x = (getWidth() - w) / 2; } g.drawImage(background, x, y, w, h); + + y += h * 2 / 3; + if (disclaimerFont == null) { + disclaimerFont = FSkinFont.get(9); + } + 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, 0, true, HAlignment.CENTER, false); } }