summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/zproject/Assets.java
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2018-07-06 11:25:44 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2018-07-06 11:25:44 +0200
commitc4f8ea5d16db402dd300d22b5e4795586068204c (patch)
treee99136013f25088499d56c171961d00afae3fc0c /core/src/ch/asynk/zproject/Assets.java
parent16b4d05cac5b0b9babf8b22eb3e2e01ece5f6352 (diff)
downloadgdx-boardgame-c4f8ea5d16db402dd300d22b5e4795586068204c.zip
gdx-boardgame-c4f8ea5d16db402dd300d22b5e4795586068204c.tar.gz
Assets : support NinePatch
Diffstat (limited to 'core/src/ch/asynk/zproject/Assets.java')
-rw-r--r--core/src/ch/asynk/zproject/Assets.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/src/ch/asynk/zproject/Assets.java b/core/src/ch/asynk/zproject/Assets.java
index 1e66e23..7602d7c 100644
--- a/core/src/ch/asynk/zproject/Assets.java
+++ b/core/src/ch/asynk/zproject/Assets.java
@@ -6,6 +6,7 @@ import com.badlogic.gdx.assets.loaders.resolvers.InternalFileHandleResolver;
import com.badlogic.gdx.utils.Disposable;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
+import com.badlogic.gdx.graphics.g2d.NinePatch;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGeneratorLoader;
@@ -20,6 +21,7 @@ public class Assets extends AssetManager implements Disposable
public static final String FONT = "data/veteran-typewriter.ttf";
public static final String FONT_20 = "size20.ttf";
public static final String FONT_25 = "size25.ttf";
+ public static final String PATCH = "data/ui-patch.png";
private final FreeTypeFontLoaderParameter params20;
private final FreeTypeFontLoaderParameter params25;
@@ -50,6 +52,11 @@ public class Assets extends AssetManager implements Disposable
return get(assetName, Texture.class);
}
+ public NinePatch getNinePatch(String assetName, int left, int right, int top, int bottom)
+ {
+ return new NinePatch(get(assetName, Texture.class), left, right, top, bottom);
+ }
+
public TextureAtlas getAtlas(String assetName)
{
return get(assetName, TextureAtlas.class);
@@ -74,6 +81,7 @@ public class Assets extends AssetManager implements Disposable
{
load(MAP_00, Texture.class);
load(CORNER, Texture.class);
+ load(PATCH, Texture.class);
load(FONT_20, BitmapFont.class, params20);
load(FONT_25, BitmapFont.class, params25);
}
@@ -82,6 +90,7 @@ public class Assets extends AssetManager implements Disposable
{
unload(MAP_00);
unload(CORNER);
+ unload(PATCH);
unload(FONT_20);
unload(FONT_25);
}