mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
Fix text renderer bounds issue
Prevent setting up game state when no player has priority
This commit is contained in:
@@ -81,7 +81,7 @@ public class TextRenderer {
|
|||||||
if (fullText.isEmpty()) { return; }
|
if (fullText.isEmpty()) { return; }
|
||||||
|
|
||||||
BitmapFont bitmapFont = font.getFont();
|
BitmapFont bitmapFont = font.getFont();
|
||||||
totalHeight = bitmapFont.getLineHeight();
|
totalHeight = bitmapFont.getCapHeight();
|
||||||
if (totalHeight > height) {
|
if (totalHeight > height) {
|
||||||
//immediately try one font size smaller if no room for anything
|
//immediately try one font size smaller if no room for anything
|
||||||
if (font.getSize() > FSkinFont.MIN_FONT_SIZE) {
|
if (font.getSize() > FSkinFont.MIN_FONT_SIZE) {
|
||||||
|
|||||||
@@ -53,7 +53,9 @@ public class FTextArea extends FScrollPane {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public float getPreferredHeight(float width) {
|
public float getPreferredHeight(float width) {
|
||||||
return renderer.getWrappedBounds(text, font, width - 2 * insets.x).height + 2 * insets.y;
|
return renderer.getWrappedBounds(text, font, width - 2 * insets.x).height
|
||||||
|
+ font.getFont().getLineHeight() - font.getFont().getCapHeight() //need to account for difference in line and cap height
|
||||||
|
+ 2 * insets.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -145,6 +145,11 @@ public final class GuiDisplayUtil {
|
|||||||
final Map<ZoneType, String> aiCardTexts, final String tChangePlayer, final String tChangePhase) {
|
final Map<ZoneType, String> aiCardTexts, final String tChangePlayer, final String tChangePhase) {
|
||||||
|
|
||||||
final Game game = getGame();
|
final Game game = getGame();
|
||||||
|
Player pPriority = game.getPhaseHandler().getPriorityPlayer();
|
||||||
|
if (pPriority == null) {
|
||||||
|
SGuiDialog.message("No player has priority at the moment, so game state cannot be setup.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
game.getAction().invoke(new Runnable() {
|
game.getAction().invoke(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|||||||
Reference in New Issue
Block a user