From 32861e6c418fda80f5f0063ba235ed6e1c80ba27 Mon Sep 17 00:00:00 2001 From: fred-boy Date: Sun, 29 Sep 2019 13:09:19 +0700 Subject: [PATCH] Fix weird behavior on android --- core/src/ru/deadsoftware/cavedroid/misc/Assets.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/core/src/ru/deadsoftware/cavedroid/misc/Assets.java b/core/src/ru/deadsoftware/cavedroid/misc/Assets.java index b01153a..0dd1cf7 100644 --- a/core/src/ru/deadsoftware/cavedroid/misc/Assets.java +++ b/core/src/ru/deadsoftware/cavedroid/misc/Assets.java @@ -19,14 +19,14 @@ public class Assets { public static final JsonReader jsonReader = new JsonReader(); private static final GlyphLayout glyphLayout = new GlyphLayout(); - static final BitmapFont minecraftFont = new BitmapFont(Gdx.files.internal("font.fnt"), true); + static BitmapFont minecraftFont; public static final Sprite[][] playerSprite = new Sprite[2][4]; public static final Sprite[][] pigSprite = new Sprite[2][2]; public static final HashMap textureRegions = new HashMap<>(); public static final ArrayMap guiMap = new ArrayMap<>(); - public static final Sprite sandSprite = flippedSprite(new Texture((Gdx.files.internal("textures/blocks/sand.png")))); - public static final Sprite gravelSprite = flippedSprite(new Texture((Gdx.files.internal("textures/blocks/gravel.png")))); + public static Sprite sandSprite; + public static Sprite gravelSprite; private static TextureRegion flippedRegion(Texture texture, int x, int y, int width, int height) { return new TextureRegion(texture, x, y + height, width, -height); @@ -97,10 +97,13 @@ public class Assets { } public static void load() { - minecraftFont.getData().setScale(.375f); loadPlayer(); loadPig(); loadJSON(); + minecraftFont = new BitmapFont(Gdx.files.internal("font.fnt"), true); + minecraftFont.getData().setScale(.375f); + sandSprite = flippedSprite(new Texture((Gdx.files.internal("textures/blocks/sand.png")))); + gravelSprite = flippedSprite(new Texture((Gdx.files.internal("textures/blocks/gravel.png")))); } /** -- 2.29.2