From a3cc8e9523d1ca22588908bdd5b13d9a8fa58a07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Thu, 20 Sep 2018 16:43:14 +0200 Subject: add sherman unit to tests --- assets/data/sherman.png | Bin 0 -> 23223 bytes test/src/ch/asynk/gdx/board/test/Assets.java | 3 +++ test/src/ch/asynk/gdx/board/test/GameBoard.java | 4 ++++ 3 files changed, 7 insertions(+) create mode 100644 assets/data/sherman.png diff --git a/assets/data/sherman.png b/assets/data/sherman.png new file mode 100644 index 0000000..bcfab18 Binary files /dev/null and b/assets/data/sherman.png differ diff --git a/test/src/ch/asynk/gdx/board/test/Assets.java b/test/src/ch/asynk/gdx/board/test/Assets.java index 19e16df..c3d76ab 100644 --- a/test/src/ch/asynk/gdx/board/test/Assets.java +++ b/test/src/ch/asynk/gdx/board/test/Assets.java @@ -22,6 +22,7 @@ public class Assets extends ch.asynk.gdx.tabletop.Assets public static final String FONT_20 = "size20.ttf"; public static final String FONT_25 = "size25.ttf"; public static final String PATCH = "ui-patch.png"; + public static final String SHERMAN = "sherman.png"; private final FreeTypeFontLoaderParameter params20; private final FreeTypeFontLoaderParameter params25; @@ -64,6 +65,7 @@ public class Assets extends ch.asynk.gdx.tabletop.Assets load(TRI, Texture.class); load(CORNER, Texture.class); load(PATCH, Texture.class); + load(SHERMAN, Texture.class); load(FONT_20, BitmapFont.class, params20); load(FONT_25, BitmapFont.class, params25); } @@ -75,6 +77,7 @@ public class Assets extends ch.asynk.gdx.tabletop.Assets unload(TRI); unload(CORNER); unload(PATCH); + unload(SHERMAN); unload(FONT_20); unload(FONT_25); } diff --git a/test/src/ch/asynk/gdx/board/test/GameBoard.java b/test/src/ch/asynk/gdx/board/test/GameBoard.java index e065745..801e947 100644 --- a/test/src/ch/asynk/gdx/board/test/GameBoard.java +++ b/test/src/ch/asynk/gdx/board/test/GameBoard.java @@ -13,6 +13,7 @@ public class GameBoard implements Disposable, Touchable { private final Assets assets; private Texture map; + private Texture sherman; private Board board; private int dx; @@ -27,6 +28,7 @@ public class GameBoard implements Disposable, Touchable { this.assets = assets; this.v = new Vector2(); + this.sherman = assets.getTexture(assets.SHERMAN); setState(GameScreen.State.UI); } @@ -64,6 +66,7 @@ public class GameBoard implements Disposable, Touchable setTRI_V(); break; } + board.centerOf(0, 0, v); } private void setHEX_V() @@ -134,5 +137,6 @@ public class GameBoard implements Disposable, Touchable public void draw(Batch batch) { batch.draw(map, dx, dy, map.getWidth()/2, map.getHeight()/2, map.getWidth(), map.getHeight(), 1, 1, r, 0, 0, map.getWidth(), map.getHeight(), false, false); + batch.draw(sherman, v.x - (sherman.getWidth() / 2), v.y - (sherman.getHeight() / 2)); } } -- cgit v1.1-2-g2b99