X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=core%2Fsrc%2Fru%2Fdeadsoftware%2Fcavedroid%2Fmisc%2FAssets.java;h=1e531415c63baaefd9a04111ec9e663f5cda544a;hb=59d48c1b28c570755327a8fb0827fa57e7fd3914;hp=944dec0cac70dd82b77d5c9a6d2f782b9e64f81b;hpb=107d9b29535be2cad37c8c5a48769c68689e6b33;p=cavedroid.git diff --git a/core/src/ru/deadsoftware/cavedroid/misc/Assets.java b/core/src/ru/deadsoftware/cavedroid/misc/Assets.java index 944dec0..1e53141 100644 --- a/core/src/ru/deadsoftware/cavedroid/misc/Assets.java +++ b/core/src/ru/deadsoftware/cavedroid/misc/Assets.java @@ -6,26 +6,24 @@ import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.GlyphLayout; import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.TextureRegion; -import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.utils.ArrayMap; import com.badlogic.gdx.utils.JsonReader; import com.badlogic.gdx.utils.JsonValue; +import ru.deadsoftware.cavedroid.game.objects.TouchButton; import java.util.HashMap; 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);; - 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 final ArrayMap guiMap = new ArrayMap<>(); + private static final GlyphLayout glyphLayout = new GlyphLayout(); + public static Sprite sandSprite; + public static Sprite gravelSprite; + static BitmapFont minecraftFont; private static TextureRegion flippedRegion(Texture texture, int x, int y, int width, int height) { return new TextureRegion(texture, x, y + height, width, -height); @@ -82,7 +80,8 @@ public class Assets { for (JsonValue file = json.child(); file != null; file = file.next()) { Texture texture = new Texture(Gdx.files.internal(file.name() + ".png")); if (file.size == 0) { - textureRegions.put(file.name(), flippedRegion(texture, 0, 0, texture.getWidth(), texture.getHeight())); + textureRegions.put(file.name(), + flippedRegion(texture, 0, 0, texture.getWidth(), texture.getHeight())); } else { for (JsonValue key = file.child(); key != null; key = key.next()) { int x = getIntFromJson(key, "x", 0); @@ -96,10 +95,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")))); } /**