diff --git a/.gitignore b/.gitignore index 976f160..511f030 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,8 @@ /bin/ /target/ /.rogue-save/ +/build/.rogue-save/ +/build/out/*.jar +/build/in/*.jar *.log .attach_pid* \ No newline at end of file diff --git a/README.md b/README.md index 82e523a..3f1b314 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,6 @@ Goals ----- - Simple retro-themed dungeon crawler -- (Multiplayer support) <- maybe -- Threads for resource loading and event handling Features @@ -15,17 +13,19 @@ Features - Full OOP design - Event driven - OpenGL 2D rendering -- Screen / layer based graphics with Constraint System. +- Screen / layer based graphics with Constraint System +- A* path-finding system +- Audio, Font & Texture systems +- Easily extensible base framework Gameplay -------------- -- Random floors -- Turn-based -- Monsters with AI (-> combat system) -- Collectable items, armor upgrades etc. -- Health, Hunger, Level +- Real-time action +- Monsters with AI +- Collectable items (weapons, food) +- Random floor generator Used libraries diff --git a/build/Makefile b/build/Makefile new file mode 100644 index 0000000..8ee896c --- /dev/null +++ b/build/Makefile @@ -0,0 +1,32 @@ +STUB = ./stub.jar + +IN_DIR = ./in +IN = $(IN_DIR)/build.jar + +OUT_DIR = ./out +OUT = $(OUT_DIR)/release.jar + +TMP_DIR = ./tmp + +all: + # clean + mkdir -p $(TMP_DIR) + mkdir -p $(OUT_DIR) + + # extract + unzip $(IN) -d $(TMP_DIR) + + rm -rf $(TMP_DIR)/META-INF + + unzip $(STUB) -d $(TMP_DIR) + + # export + (cd $(TMP_DIR); zip -r9 ./pack.zip .) + mv -f $(TMP_DIR)/pack.zip $(OUT) + chmod +x $(OUT) + + # clean + rm -rf $(TMP_DIR) + +run: + java -jar $(OUT) \ No newline at end of file diff --git a/build/export.jardesc b/build/export.jardesc new file mode 100644 index 0000000..cbe6960 --- /dev/null +++ b/build/export.jardesc @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/res/.gitkeep b/build/in/.gitkeep similarity index 100% rename from res/.gitkeep rename to build/in/.gitkeep diff --git a/build/out/.gitkeep b/build/out/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/build/stub.jar b/build/stub.jar new file mode 100644 index 0000000..066fcac Binary files /dev/null and b/build/stub.jar differ diff --git a/build/~fatjar/fatjar.sh b/build/~fatjar/fatjar.sh new file mode 100755 index 0000000..adae3bb --- /dev/null +++ b/build/~fatjar/fatjar.sh @@ -0,0 +1,2 @@ +#! /bin/bash +java -jar ./jarsplice-0.40.jar \ No newline at end of file diff --git a/build/~fatjar/jarsplice-0.40.jar b/build/~fatjar/jarsplice-0.40.jar new file mode 100755 index 0000000..44fd3a6 Binary files /dev/null and b/build/~fatjar/jarsplice-0.40.jar differ diff --git a/src/mightypork/gamecore/render/Render.java b/src/mightypork/gamecore/render/Render.java index 66bd8fb..ba5e512 100644 --- a/src/mightypork/gamecore/render/Render.java +++ b/src/mightypork/gamecore/render/Render.java @@ -20,7 +20,6 @@ import mightypork.gamecore.util.math.constraints.vect.VectConst; import org.lwjgl.opengl.GL11; import org.newdawn.slick.opengl.Texture; import org.newdawn.slick.opengl.TextureLoader; -import org.newdawn.slick.util.ResourceLoader; /** @@ -308,7 +307,7 @@ public class Render { final String ext = FileUtils.getExtension(resourcePath).toUpperCase(); - final Texture texture = TextureLoader.getTexture(ext, ResourceLoader.getResourceAsStream(resourcePath), false, filtering.num); + final Texture texture = TextureLoader.getTexture(ext, FileUtils.getResource(resourcePath), false, filtering.num); if (texture == null) { Log.w("Texture " + resourcePath + " could not be loaded."); diff --git a/src/mightypork/gamecore/resources/audio/DeferredAudio.java b/src/mightypork/gamecore/resources/audio/DeferredAudio.java index 2c42e5a..e8ab58f 100644 --- a/src/mightypork/gamecore/resources/audio/DeferredAudio.java +++ b/src/mightypork/gamecore/resources/audio/DeferredAudio.java @@ -2,6 +2,7 @@ package mightypork.gamecore.resources.audio; import java.io.IOException; +import java.io.InputStream; import mightypork.gamecore.logging.LogAlias; import mightypork.gamecore.resources.loading.DeferredResource; @@ -91,20 +92,23 @@ public class DeferredAudio extends DeferredResource { { final String ext = FileUtils.getExtension(resource); - if (ext.equalsIgnoreCase("ogg")) { - backingAudio = SoundStore.get().getOgg(resource); + try(final InputStream stream = FileUtils.getResource(resource)) { - } else if (ext.equalsIgnoreCase("wav")) { - backingAudio = SoundStore.get().getWAV(resource); - - } else if (ext.equalsIgnoreCase("aif")) { - backingAudio = SoundStore.get().getAIF(resource); - - } else if (ext.equalsIgnoreCase("mod")) { - backingAudio = SoundStore.get().getMOD(resource); - - } else { - throw new RuntimeException("Invalid audio file extension."); + if (ext.equalsIgnoreCase("ogg")) { + backingAudio = SoundStore.get().getOgg(resource, stream); + + } else if (ext.equalsIgnoreCase("wav")) { + backingAudio = SoundStore.get().getWAV(resource, stream); + + } else if (ext.equalsIgnoreCase("aif")) { + backingAudio = SoundStore.get().getAIF(resource, stream); + + } else if (ext.equalsIgnoreCase("mod")) { + backingAudio = SoundStore.get().getMOD(resource, stream); + + } else { + throw new RuntimeException("Invalid audio file extension."); + } } } diff --git a/src/mightypork/gamecore/util/files/InstanceLock.java b/src/mightypork/gamecore/util/files/InstanceLock.java index 6114a7a..784cda4 100644 --- a/src/mightypork/gamecore/util/files/InstanceLock.java +++ b/src/mightypork/gamecore/util/files/InstanceLock.java @@ -18,6 +18,7 @@ public class InstanceLock { public static boolean onFile(final File lockFile) { try { + lockFile.getParentFile().mkdirs(); final RandomAccessFile randomAccessFile = new RandomAccessFile(lockFile, "rw"); final FileLock fileLock = randomAccessFile.getChannel().tryLock(); @@ -44,6 +45,8 @@ public class InstanceLock { return false; } catch (final IOException e) { + System.err.println("IO error while obtaining lock."); + e.printStackTrace(); return false; } }