summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2018-11-19 13:11:43 +0100
committerNao Pross <naopross@thearcway.org>2018-11-19 13:11:43 +0100
commit2c176589c24093ae93ec45e8d208dce81c27a515 (patch)
treeeba17e826ed3e159c03b2b4ccc269c1bae131693
parentSet up CardLayout for GameWindow and Scene pause/resume (diff)
downloadSubconscious-java-2c176589c24093ae93ec45e8d208dce81c27a515.tar.gz
Subconscious-java-2c176589c24093ae93ec45e8d208dce81c27a515.zip
Create java package for the project
Diffstat (limited to '')
-rw-r--r--Makefile34
-rw-r--r--src/subconscious/Actor.java (renamed from src/Actor.java)2
-rw-r--r--src/subconscious/Map.java (renamed from src/Map.java)2
-rw-r--r--src/subconscious/MapLoader.java (renamed from src/MapLoader.java)4
-rw-r--r--src/subconscious/Subconscious.java (renamed from src/Subconscious.java)3
-rw-r--r--src/subconscious/Tile.java (renamed from src/Tile.java)2
-rw-r--r--src/subconscious/Weapon.java (renamed from src/Weapon.java)2
-rw-r--r--src/subconscious/graphics/BattleScene.java (renamed from src/BattleScene.java)7
-rw-r--r--src/subconscious/graphics/GameWindow.java (renamed from src/GameWindow.java)2
-rw-r--r--src/subconscious/graphics/MapEditorScene.java (renamed from src/MapEditorScene.java)7
-rw-r--r--src/subconscious/graphics/MapScene.java (renamed from src/MapScene.java)12
-rw-r--r--src/subconscious/graphics/Scene.java (renamed from src/Scene.java)2
-rw-r--r--src/subconscious/util/Palette.java (renamed from src/Palette.java)2
13 files changed, 61 insertions, 20 deletions
diff --git a/Makefile b/Makefile
index 3955d69..bdb14d3 100644
--- a/Makefile
+++ b/Makefile
@@ -1,14 +1,25 @@
-MAINCLASS := Subconscious
-JAVAC_ARGS := -Xlint:all
+MAINCLASS := subconscious.Subconscious
-.PHONY: all run pack build dirs clean
-all: build
+JAVAC := javac
+JAVAC_ARGS := -Xlint:all \
+ -classpath lib/gson-2.6.2.jar:. \
+ -sourcepath src
-run: build
- cd bin && java -Dawt.useSystemAAFontSettings=on -cp ../lib/gson-2.6.2.jar:. $(MAINCLASS)
+SOURCES := $(shell find src -iname '*.java')
+
+.PHONY: all run pack classes dirs clean
+all: classes
+
+classes:
+ $(JAVAC) $(JAVAC_ARGS) -d build $(SOURCES)
.ONESHELL:
-pack: build
+run: classes
+ cd build
+ java -Dawt.useSystemAAFontSettings=on -cp ../lib/gson-2.6.2.jar:. $(MAINCLASS)
+
+.ONESHELL:
+pack: classes
echo "Main-Class: $(MAINCLASS)" > jar/manifest.txt
jar cvfm jar/$(MAINCLASS).jar jar/manifest.txt -C bin/ .
rm jar/manifest.txt
@@ -22,13 +33,10 @@ pack: build
zip -r Subconcious.jar ./*
find . ! -name 'Subconcious.jar' -type f -exec rm -f {} +
rm -R com META-INF
-
-build: dirs
- javac $(JAVAC_ARGS) -cp lib/gson-2.6.2.jar:. -d bin/ src/*.java
+
dirs:
- mkdir -p src bin jar
+ mkdir -p build
clean:
- rm -R jar/*
- rm bin/*
+ rm -rd build \ No newline at end of file
diff --git a/src/Actor.java b/src/subconscious/Actor.java
index 7b4635f..6551dab 100644
--- a/src/Actor.java
+++ b/src/subconscious/Actor.java
@@ -1,3 +1,5 @@
+package subconscious;
+
public class Actor {
private final String name;
diff --git a/src/Map.java b/src/subconscious/Map.java
index 0e0d1e3..4402790 100644
--- a/src/Map.java
+++ b/src/subconscious/Map.java
@@ -1,3 +1,5 @@
+package subconscious;
+
import java.awt.Dimension;
import java.util.ArrayList;
diff --git a/src/MapLoader.java b/src/subconscious/MapLoader.java
index 4bd4e02..2233a8d 100644
--- a/src/MapLoader.java
+++ b/src/subconscious/MapLoader.java
@@ -1,3 +1,5 @@
+package subconscious;
+
import java.lang.String;
// TODO: use java.nio? http://tutorials.jenkov.com/java-nio/nio-vs-io.html
@@ -13,7 +15,7 @@ import java.awt.Dimension;
import com.google.gson.Gson;
// TODO: this class loads AND saves classes, refractor name
-class MapLoader {
+public class MapLoader {
File path;
public MapLoader(Object path) {
diff --git a/src/Subconscious.java b/src/subconscious/Subconscious.java
index 81bc25c..384393a 100644
--- a/src/Subconscious.java
+++ b/src/subconscious/Subconscious.java
@@ -1,3 +1,6 @@
+package subconscious;
+
+import subconscious.graphics.GameWindow;
public class Subconscious {
public static void main(String[] args) {
diff --git a/src/Tile.java b/src/subconscious/Tile.java
index 7420a2a..2678043 100644
--- a/src/Tile.java
+++ b/src/subconscious/Tile.java
@@ -1,3 +1,5 @@
+package subconscious;
+
import java.util.ArrayList;
public class Tile {
diff --git a/src/Weapon.java b/src/subconscious/Weapon.java
index f20e0ca..8533b9f 100644
--- a/src/Weapon.java
+++ b/src/subconscious/Weapon.java
@@ -1,3 +1,5 @@
+package subconscious;
+
// TODO: there are object such as "puch" that need infinite durability
public class Weapon {
// TODO: if possible make final
diff --git a/src/BattleScene.java b/src/subconscious/graphics/BattleScene.java
index 443d452..b21be04 100644
--- a/src/BattleScene.java
+++ b/src/subconscious/graphics/BattleScene.java
@@ -1,3 +1,10 @@
+package subconscious.graphics;
+
+import subconscious.util.Palette;
+import subconscious.Actor;
+import subconscious.MapLoader;
+import subconscious.Tile;
+
import java.util.ArrayList;
import java.util.Collections;
diff --git a/src/GameWindow.java b/src/subconscious/graphics/GameWindow.java
index a908a0a..4d2f91c 100644
--- a/src/GameWindow.java
+++ b/src/subconscious/graphics/GameWindow.java
@@ -1,4 +1,4 @@
-// TODO: package
+package subconscious.graphics;
import java.awt.Dimension;
import java.awt.GridLayout;
diff --git a/src/MapEditorScene.java b/src/subconscious/graphics/MapEditorScene.java
index 5f6bda5..d6e8be4 100644
--- a/src/MapEditorScene.java
+++ b/src/subconscious/graphics/MapEditorScene.java
@@ -1,3 +1,10 @@
+package subconscious.graphics;
+
+import subconscious.Actor;
+import subconscious.Tile;
+import subconscious.Map;
+import subconscious.MapLoader;
+
import java.util.ArrayList;
import java.awt.Canvas;
diff --git a/src/MapScene.java b/src/subconscious/graphics/MapScene.java
index 7ed8e3b..933526b 100644
--- a/src/MapScene.java
+++ b/src/subconscious/graphics/MapScene.java
@@ -1,3 +1,10 @@
+package subconscious.graphics;
+
+import subconscious.util.Palette;
+import subconscious.Map;
+import subconscious.Tile;
+import subconscious.Actor;
+
import java.awt.Canvas;
import java.awt.Graphics2D;
import java.awt.BasicStroke;
@@ -25,10 +32,6 @@ import java.io.FileReader;
import java.io.BufferedReader;
import java.io.IOException;
-// TODO: remove unused import
-import com.google.gson.Gson;
-
-
public abstract class MapScene extends Scene implements ActionListener {
protected Map map;
@@ -59,7 +62,6 @@ public abstract class MapScene extends Scene implements ActionListener {
this.maxSize = HEIGHT;
}
- // TODO: negate if condition and return
if (this.map == null) {
return;
}
diff --git a/src/Scene.java b/src/subconscious/graphics/Scene.java
index 0ecf22f..53b936c 100644
--- a/src/Scene.java
+++ b/src/subconscious/graphics/Scene.java
@@ -1,3 +1,5 @@
+package subconscious.graphics;
+
import java.awt.Canvas;
import java.awt.Graphics2D;
import java.awt.Dimension;
diff --git a/src/Palette.java b/src/subconscious/util/Palette.java
index ee4d747..adab9ad 100644
--- a/src/Palette.java
+++ b/src/subconscious/util/Palette.java
@@ -1,3 +1,5 @@
+package subconscious.util;
+
import java.awt.Color;
public class Palette {