diff options
author | Nao Pross <naopross@thearcway.org> | 2018-12-15 14:59:28 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2018-12-15 14:59:28 +0100 |
commit | 03a92d22027ef0738d1ebfd59145236905751425 (patch) | |
tree | f488a709b1180c6f5e82c71c3fcd39c2a71e6576 | |
parent | Change Tile.loaded to Tile.active (diff) | |
download | Subconscious-java-03a92d22027ef0738d1ebfd59145236905751425.tar.gz Subconscious-java-03a92d22027ef0738d1ebfd59145236905751425.zip |
Remove Gson dependency start custom libjtmx implementation
This commit breaks MapLoader and by consequence the entire game.
Being in Java 9+ now we will have multiple modules, namely:
- libjtmx: separate minimal tmx (tiled) files loader library
- subconscious: the game itself
-rw-r--r-- | Makefile | 13 | ||||
-rw-r--r-- | lib/gson-2.6.2.jar | bin | 229650 -> 0 bytes | |||
-rw-r--r-- | manifest.txt | 1 | ||||
-rw-r--r-- | src/libjtmx/Map.java | 10 | ||||
-rw-r--r-- | src/libjtmx/module-info.java | 3 | ||||
-rw-r--r-- | src/subconscious/MapLoader.java | 6 | ||||
-rw-r--r-- | src/subconscious/module-info.java | 3 |
7 files changed, 24 insertions, 12 deletions
@@ -1,6 +1,5 @@ # project classes configuration MAINCLASS := subconscious.Subconscious -SOURCES := $(shell find src -iname '*.java') # debug or release mode DEBUG=1 @@ -9,7 +8,6 @@ LIMIT_RAM=1 # java compiler configuraton JAVAC := javac JAVAC_ARGS := -Xlint:all -Xdiags:verbose \ - -classpath lib/gson-2.6.2.jar:. \ -sourcepath src # java debugger configuration @@ -19,7 +17,7 @@ USE_JDB := 0 # java runtime configuration JAVA := java -JAVA_ARGS := -cp ../lib/gson-2.6.2.jar:. +JAVA_ARGS := ifeq ($(LIMIT_RAM),1) JAVA_ARGS += -Xmx2G endif @@ -33,10 +31,13 @@ endif # recipes .PHONY: all run jar classes dirs clean -all: classes +all: subconscious libjtmx -classes: dirs - $(JAVAC) $(JAVAC_ARGS) -d build $(SOURCES) +libjtmx: dirs + $(JAVAC) $(JAVAC_ARGS) -d build $(shell find src/libjtmx -iname '*.java') + +subconscious: dirs + $(JAVAC) $(JAVAC_ARGS) -d build $(shell find src/subconscious -iname '*.java') # copy resources folder cp -r src/subconscious/res build/subconscious/ diff --git a/lib/gson-2.6.2.jar b/lib/gson-2.6.2.jar Binary files differdeleted file mode 100644 index 9d78626..0000000 --- a/lib/gson-2.6.2.jar +++ /dev/null diff --git a/manifest.txt b/manifest.txt index 9ecb5af..73fcb85 100644 --- a/manifest.txt +++ b/manifest.txt @@ -1,2 +1 @@ Main-Class: subconscious.Subconscious -Class-Path: ../lib/gson-2.6.2.jar diff --git a/src/libjtmx/Map.java b/src/libjtmx/Map.java new file mode 100644 index 0000000..d9333a8 --- /dev/null +++ b/src/libjtmx/Map.java @@ -0,0 +1,10 @@ +package libjtmx; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class Map { + +}
\ No newline at end of file diff --git a/src/libjtmx/module-info.java b/src/libjtmx/module-info.java new file mode 100644 index 0000000..4dc4197 --- /dev/null +++ b/src/libjtmx/module-info.java @@ -0,0 +1,3 @@ +module libjtmx { + requires java.xml.bind; +}
\ No newline at end of file diff --git a/src/subconscious/MapLoader.java b/src/subconscious/MapLoader.java index 6fe1273..67425e5 100644 --- a/src/subconscious/MapLoader.java +++ b/src/subconscious/MapLoader.java @@ -9,8 +9,6 @@ import java.io.IOException; import java.awt.Dimension; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; // TODO: remove import java.lang.UnsupportedOperationException; @@ -21,8 +19,6 @@ public class MapLoader { public static final String MAPS_RESOURCES_PATH = "/subconscious/res/maps/"; - private Gson gson = new GsonBuilder().setPrettyPrinting().create();; - public MapLoader() { } @@ -50,7 +46,7 @@ public class MapLoader { } public Map parse(final String json) { - return this.gson.fromJson(json, Map.class); + throw new UnsupportedOperationException(); } // public void saveMap(Map map) { diff --git a/src/subconscious/module-info.java b/src/subconscious/module-info.java new file mode 100644 index 0000000..a6d22b9 --- /dev/null +++ b/src/subconscious/module-info.java @@ -0,0 +1,3 @@ +module subconscious { + requires java.desktop; +}
\ No newline at end of file |