summaryrefslogtreecommitdiffstats
path: root/test/src/ch/asynk/gdx/board
diff options
context:
space:
mode:
Diffstat (limited to 'test/src/ch/asynk/gdx/board')
-rw-r--r--test/src/ch/asynk/gdx/board/test/GameHud.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/test/src/ch/asynk/gdx/board/test/GameHud.java b/test/src/ch/asynk/gdx/board/test/GameHud.java
index d3495c5..f401bf9 100644
--- a/test/src/ch/asynk/gdx/board/test/GameHud.java
+++ b/test/src/ch/asynk/gdx/board/test/GameHud.java
@@ -4,6 +4,8 @@ import java.util.function.Supplier;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.Sprite;
+import com.badlogic.gdx.graphics.g2d.NinePatch;
+import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.utils.Disposable;
@@ -27,14 +29,17 @@ public class GameHud implements Disposable, Touchable
this.nextState = nextState;
this.corner = new Sprite(assets.getTexture(assets.CORNER));
+ NinePatch patch = assets.getNinePatch(assets.PATCH, 23, 23, 23 ,23);
+ BitmapFont font = assets.getFont(assets.FONT_25);
+
this.root = new Root(2);
this.root.setPadding(30);
- this.hello = new Button(assets.getFont(assets.FONT_25), assets.getNinePatch(assets.PATCH, 23, 23, 23 ,23), 10, 15);
+ this.hello = new Button(font, patch, 10, 15);
this.hello.write("Hello");
this.root.add(this.hello);
- this.next = new Button(assets.getFont(assets.FONT_25), assets.getNinePatch(assets.PATCH, 23, 23, 23 ,23), 20, 0);
+ this.next = new Button(font, patch, 20);
this.next.write("NEXT");
this.next.setPosition(50, 50);
this.next.setAlignment(Alignment.MIDDLE_CENTER);
@@ -84,7 +89,6 @@ public class GameHud implements Disposable, Touchable
{
this.next.setPosition(p, p);
this.next.setAlignment(a);
- this.next.update();
}
public void draw(Batch batch)
@@ -127,12 +131,11 @@ public class GameHud implements Disposable, Touchable
{
hello.setAlignment(Alignment.TOP_LEFT);
hello.setLabelAlignment(Alignment.BOTTOM_RIGHT);
- hello.update();
root.draw(batch);
drawHello(batch, Alignment.TOP_CENTER, Alignment.BOTTOM_CENTER);
drawHello(batch, Alignment.TOP_RIGHT, Alignment.BOTTOM_LEFT);
drawHello(batch, Alignment.MIDDLE_LEFT, Alignment.MIDDLE_RIGHT);
- // drawHello(batch, Alignment.MIDDLE_CENTER, Alignment.MIDDLE_CENTER);
+ drawHello(batch, Alignment.MIDDLE_CENTER, Alignment.MIDDLE_CENTER);
drawHello(batch, Alignment.MIDDLE_RIGHT, Alignment.MIDDLE_LEFT);
drawHello(batch, Alignment.BOTTOM_LEFT, Alignment.TOP_RIGHT);
drawHello(batch, Alignment.BOTTOM_CENTER, Alignment.TOP_CENTER);
@@ -143,7 +146,6 @@ public class GameHud implements Disposable, Touchable
{
hello.setAlignment(alignment1);
hello.setLabelAlignment(alignment2);
- hello.update();
hello.draw(batch);
}