diff --git a/.idea/misc.xml b/.idea/misc.xml
index fbe068b..e4096c2 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -11,7 +11,7 @@
-
+
\ No newline at end of file
diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..dbc578a
--- /dev/null
+++ b/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: uk.ac.york.student.DesktopLauncher
+
diff --git a/core/resources/META-INF/MANIFEST.MF b/core/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..dbc578a
--- /dev/null
+++ b/core/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: uk.ac.york.student.DesktopLauncher
+
diff --git a/core/src/uk/ac/york/student/GdxGame.java b/core/src/uk/ac/york/student/GdxGame.java
index 7e6ff3e..87b7912 100644
--- a/core/src/uk/ac/york/student/GdxGame.java
+++ b/core/src/uk/ac/york/student/GdxGame.java
@@ -6,6 +6,7 @@
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import com.badlogic.gdx.scenes.scene2d.actions.SequenceAction;
import org.jetbrains.annotations.NotNull;
+import uk.ac.york.student.assets.map.MapManager;
import uk.ac.york.student.audio.AudioManager;
import uk.ac.york.student.audio.music.MusicManager;
import uk.ac.york.student.audio.sound.SoundManager;
@@ -45,6 +46,8 @@ public void create() {
final AudioManager soundManager = SoundManager.getInstance();
soundManager.onEnable();
+ MapManager.onEnable();
+
// Set the initial screen to the loading screen
setScreen(Screens.LOADING);
}
diff --git a/core/src/uk/ac/york/student/assets/map/MapManager.java b/core/src/uk/ac/york/student/assets/map/MapManager.java
index 53727f5..deb9053 100644
--- a/core/src/uk/ac/york/student/assets/map/MapManager.java
+++ b/core/src/uk/ac/york/student/assets/map/MapManager.java
@@ -1,6 +1,7 @@
package uk.ac.york.student.assets.map;
import com.badlogic.gdx.Gdx;
+import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.maps.tiled.TiledMap;
import com.badlogic.gdx.maps.tiled.TmxMapLoader;
@@ -9,6 +10,7 @@
import uk.ac.york.student.utils.MapOfSuppliers;
import java.io.File;
+import java.util.List;
import java.util.Objects;
/**
@@ -25,24 +27,23 @@ public final class MapManager {
@Getter
private static final MapOfSuppliers maps = new MapOfSuppliers<>();
- // Static initializer block that loads the maps from the "map" directory in the internal "assets" directory
- static {
- // Get the directory containing the map files
- File mapFiles = Gdx.files.internal("map").file();
- // Throw an exception if the directory does not exist
- if (!mapFiles.isDirectory()) throw new RuntimeException("map directory not found");
+ public static void onEnable() {
+ List maps = List.of("map", "blankMap", "inside_house");
// Create parameters for loading the maps
TmxMapLoader.Parameters parameter = new TmxMapLoader.Parameters();
parameter.textureMinFilter = Texture.TextureFilter.Nearest;
parameter.textureMagFilter = Texture.TextureFilter.Nearest;
// Load each map file in the directory (and hide the potential NullPointerException with Objects.requireNonNull)
- for (File file : Objects.requireNonNull(mapFiles.listFiles())) {
+ for (String map : maps) {
+ map = "map/" + map + ".tmx";
+ FileHandle internal = Gdx.files.internal(map);
+ File file = internal.file();
// Only load files with the ".tmx" extension
if (file.getName().endsWith(".tmx")) {
// Add the map to the MapOfSuppliers, using a lambda to allow for lazy loading
- maps.put(file.getName().replace(".tmx", ""), () -> new TmxMapLoader().load("map/" + file.getName(), parameter));
+ MapManager.maps.put(file.getName().replace(".tmx", ""), () -> new TmxMapLoader().load("map/" + file.getName(), parameter));
}
}
}
diff --git a/core/src/uk/ac/york/student/screens/MainMenuScreen.java b/core/src/uk/ac/york/student/screens/MainMenuScreen.java
index cfca775..94280ea 100644
--- a/core/src/uk/ac/york/student/screens/MainMenuScreen.java
+++ b/core/src/uk/ac/york/student/screens/MainMenuScreen.java
@@ -1,6 +1,7 @@
package uk.ac.york.student.screens;
import com.badlogic.gdx.Gdx;
+import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Batch;