diff options
Diffstat (limited to '')
-rw-r--r-- | src/subconscious/Game.java | 2 | ||||
-rw-r--r-- | src/subconscious/MapLoader.java | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/subconscious/Game.java b/src/subconscious/Game.java index 7ef3e8d..a7493b3 100644 --- a/src/subconscious/Game.java +++ b/src/subconscious/Game.java @@ -45,7 +45,7 @@ public class Game { // TODO: this will be replaced with a dynamic mechanism based // on the progress within the game - Map testMap = this.mapLoader.get("/subconscious/res/maps/testmap.json"); + Map testMap = this.mapLoader.get("testmap.json"); this.currentMap = testMap; this.maps.add(testMap); diff --git a/src/subconscious/MapLoader.java b/src/subconscious/MapLoader.java index b7e97d2..b89f8b0 100644 --- a/src/subconscious/MapLoader.java +++ b/src/subconscious/MapLoader.java @@ -19,6 +19,8 @@ import java.lang.UnsupportedOperationException; // TODO: this class loads AND saves classes, refractor name public class MapLoader { + public static final String MAPS_RESOURCES_PATH = "/subconscious/res/maps/"; + private Gson gson = new GsonBuilder().setPrettyPrinting().create();; public MapLoader() { @@ -30,7 +32,11 @@ public class MapLoader { throw new UnsupportedOperationException(); } - public Map get(final String resourceName) { + public Map get(final String mapName) { + return this.getAbsolute(MAPS_RESOURCES_PATH + mapName); + } + + public Map getAbsolute(final String resourceName) { InputStream is = MapLoader.class.getResourceAsStream(resourceName); assert is != null; |