From 3a9c44fc3d3e656165d6a9b2c62ca6e98143fd61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Fri, 1 May 2015 20:18:54 +0200 Subject: update libgdx 1.4.1 -> 1.5.6 --- build.gradle | 2 +- core/src/ch/asynk/tankontank/menu/OptionsMenu.java | 5 ++++- core/src/ch/asynk/tankontank/menu/ScenariosMenu.java | 5 ++++- core/src/ch/asynk/tankontank/ui/Label.java | 12 +++++++----- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index 4d9d7cc..be01b1a 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ allprojects { version = '1.0' ext { appName = 'TankOnTank' - gdxVersion = '1.4.1' + gdxVersion = '1.5.6' roboVMVersion = '0.0.14' } diff --git a/core/src/ch/asynk/tankontank/menu/OptionsMenu.java b/core/src/ch/asynk/tankontank/menu/OptionsMenu.java index b073731..c866d30 100644 --- a/core/src/ch/asynk/tankontank/menu/OptionsMenu.java +++ b/core/src/ch/asynk/tankontank/menu/OptionsMenu.java @@ -2,6 +2,7 @@ package ch.asynk.tankontank.menu; import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.graphics.g2d.BitmapFont; +import com.badlogic.gdx.graphics.g2d.GlyphLayout; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import ch.asynk.tankontank.ui.Label; @@ -76,7 +77,9 @@ public class OptionsMenu extends Patch this.checkLabels[i] = l; } getValues(); - checkDy = font.getMultiLineBounds(CHECK).height + 5; + GlyphLayout layout = new GlyphLayout(); + layout.setText(font, CHECK); + checkDy = layout.height + 5; this.visible = false; } diff --git a/core/src/ch/asynk/tankontank/menu/ScenariosMenu.java b/core/src/ch/asynk/tankontank/menu/ScenariosMenu.java index 1eb32fa..7cd6499 100644 --- a/core/src/ch/asynk/tankontank/menu/ScenariosMenu.java +++ b/core/src/ch/asynk/tankontank/menu/ScenariosMenu.java @@ -2,6 +2,7 @@ package ch.asynk.tankontank.menu; import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.graphics.g2d.BitmapFont; +import com.badlogic.gdx.graphics.g2d.GlyphLayout; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import ch.asynk.tankontank.ui.Label; @@ -45,7 +46,9 @@ public class ScenariosMenu extends Patch l.write(game.factory.battles[i].getName()); battleLabels[i] = l; } - checkDy = font.getMultiLineBounds(CHECK).height + 9; + GlyphLayout layout = new GlyphLayout(); + layout.setText(font, CHECK); + checkDy = layout.height + 9; this.visible = false; this.launch = false; diff --git a/core/src/ch/asynk/tankontank/ui/Label.java b/core/src/ch/asynk/tankontank/ui/Label.java index eae4b15..041f44d 100644 --- a/core/src/ch/asynk/tankontank/ui/Label.java +++ b/core/src/ch/asynk/tankontank/ui/Label.java @@ -2,11 +2,12 @@ package ch.asynk.tankontank.ui; import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.graphics.g2d.BitmapFont; -import com.badlogic.gdx.graphics.g2d.BitmapFont.TextBounds; +import com.badlogic.gdx.graphics.g2d.GlyphLayout; public class Label extends Widget { private BitmapFont font; + private GlyphLayout layout; private float dx; private float dy; protected String text; @@ -27,6 +28,7 @@ public class Label extends Widget this.font = font; this.padding = padding; this.position = position; + this.layout = new GlyphLayout(); } @Override @@ -43,10 +45,10 @@ public class Label extends Widget @Override public void setPosition(float x, float y) { - TextBounds b = font.getMultiLineBounds((text == null) ? "" : text); - setPosition(x, y, (b.width + (2 * padding)), (b.height + (2 * padding))); + this.layout.setText(font, (text == null) ? "" : text); + setPosition(x, y, (layout.width + (2 * padding)), (layout.height + (2 * padding))); this.dx = (x + padding); - this.dy = (y + padding + b.height); + this.dy = (y + padding + layout.height); } public void write(String text) @@ -65,6 +67,6 @@ public class Label extends Widget public void draw(Batch batch) { if (!visible) return; - font.drawMultiLine(batch, text, dx, dy); + font.draw(batch, layout, dx, dy); } } -- cgit v1.1-2-g2b99