diff --git a/.gitignore b/.gitignore
index 92145bc..97adb72 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
/bin/
-/target/
\ No newline at end of file
+/target/
+*.log
\ No newline at end of file
diff --git a/README.md b/README.md
index 7f5350a..d736bc7 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
-Dungeon crawler RPG
-===================
+Rogue - dungeon crawler
+=======================
Goals
-----
@@ -11,10 +11,19 @@ Goals
Features
--------
-- Randomly generated floors
-- Hybrid turn-based gameplay
+- Full OOP design
+- Event driven
+- OpenGL 2D rendering
+
+- Random floors
+- Real-time gameplay
+- Monsters with AI (-> combat system)
+
+
+Possibly added
+--------------
+
- Stats and leveling
-- Monsters
- Collectable items
- Potions, food
- Simple inventory system
@@ -24,5 +33,4 @@ Used libraries
--------------
- Slick2D
-- NiftyGUI
- LWJGL
\ No newline at end of file
diff --git a/res/.gitkeep b/res/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/src/mightypork/rogue/App.java b/src/mightypork/rogue/App.java
index 4a1c8df..dcf4ea1 100644
--- a/src/mightypork/rogue/App.java
+++ b/src/mightypork/rogue/App.java
@@ -7,10 +7,10 @@ import java.nio.channels.FileLock;
import javax.swing.JOptionPane;
+import mightypork.rogue.bus.events.UpdateEvent;
import mightypork.rogue.display.DisplaySystem;
import mightypork.rogue.display.Screen;
import mightypork.rogue.display.ScreenTestAnimations;
-import mightypork.rogue.display.events.UpdateEvent;
import mightypork.rogue.input.InputSystem;
import mightypork.rogue.input.KeyStroke;
import mightypork.rogue.sounds.SoundSystem;
@@ -25,6 +25,11 @@ import mightypork.utils.time.TimerDelta;
import org.lwjgl.input.Keyboard;
+/**
+ * Main class
+ *
+ * @author MightyPork
+ */
public class App implements Destroyable, AppAccess {
/** instance pointer */
@@ -61,7 +66,7 @@ public class App implements Destroyable, AppAccess {
/**
- * Show crash report dialog with error stack trace.
+ * Handle a crash
*
* @param error
*/
@@ -69,15 +74,12 @@ public class App implements Destroyable, AppAccess {
{
Log.e("The game has crashed.", error);
- if (inst != null) inst.exit();
+ if (inst != null) inst.shutdown();
}
- /**
- * Quit to OS
- * Destroy app & exit VM
- */
- public void exit()
+ @Override
+ public void shutdown()
{
destroy();
System.exit(0);
@@ -121,7 +123,7 @@ public class App implements Destroyable, AppAccess {
);
//@formatter:on
- exit();
+ shutdown();
return;
}
}
@@ -165,7 +167,7 @@ public class App implements Destroyable, AppAccess {
private void initBus()
{
events = new MessageBus();
- events.addSubscriber(this);
+ events.subscribe(this);
events.createChannel(UpdateEvent.class, UpdateEvent.Listener.class);
}
@@ -214,7 +216,7 @@ public class App implements Destroyable, AppAccess {
public void run()
{
Log.f3("CTRL+Q, shutting down.");
- exit();
+ shutdown();
}
});
}
@@ -246,7 +248,7 @@ public class App implements Destroyable, AppAccess {
{
initialize();
mainLoop();
- exit();
+ shutdown();
}
/** timer */
@@ -293,7 +295,7 @@ public class App implements Destroyable, AppAccess {
* @return sound system of the running instance
*/
@Override
- public SoundSystem soundsys()
+ public SoundSystem snd()
{
return sounds;
}
@@ -323,7 +325,7 @@ public class App implements Destroyable, AppAccess {
* @return event bus
*/
@Override
- public MessageBus msgbus()
+ public MessageBus bus()
{
return events;
}
diff --git a/src/mightypork/rogue/AppAccess.java b/src/mightypork/rogue/AppAccess.java
index c2776d2..6a7796a 100644
--- a/src/mightypork/rogue/AppAccess.java
+++ b/src/mightypork/rogue/AppAccess.java
@@ -17,7 +17,7 @@ public interface AppAccess {
/**
* @return sound system
*/
- abstract SoundSystem soundsys();
+ abstract SoundSystem snd();
/**
@@ -35,6 +35,13 @@ public interface AppAccess {
/**
* @return event bus
*/
- abstract MessageBus msgbus();
+ abstract MessageBus bus();
+
+
+ /**
+ * Quit to OS
+ * Destroy app & exit VM
+ */
+ abstract void shutdown();
}
diff --git a/src/mightypork/rogue/AppAdapter.java b/src/mightypork/rogue/AppAdapter.java
new file mode 100644
index 0000000..19c847d
--- /dev/null
+++ b/src/mightypork/rogue/AppAdapter.java
@@ -0,0 +1,61 @@
+package mightypork.rogue;
+
+
+import mightypork.rogue.display.DisplaySystem;
+import mightypork.rogue.input.InputSystem;
+import mightypork.rogue.sounds.SoundSystem;
+import mightypork.utils.patterns.subscription.MessageBus;
+
+
+/**
+ * App access adapter
+ *
+ * @author MightyPork
+ */
+public class AppAdapter implements AppAccess {
+
+ private AppAccess app;
+
+
+ public AppAdapter(AppAccess app) {
+ if (app == null) throw new NullPointerException("AppAccess instance cannot be null.");
+
+ this.app = app;
+ }
+
+
+ @Override
+ public final SoundSystem snd()
+ {
+ return app.snd();
+ }
+
+
+ @Override
+ public final InputSystem input()
+ {
+ return app.input();
+ }
+
+
+ @Override
+ public final DisplaySystem disp()
+ {
+ return app.disp();
+ }
+
+
+ @Override
+ public final MessageBus bus()
+ {
+ return app.bus();
+ }
+
+
+ @Override
+ public void shutdown()
+ {
+ app.shutdown();
+ }
+
+}
diff --git a/src/mightypork/rogue/AppSubsystem.java b/src/mightypork/rogue/AppSubsystem.java
deleted file mode 100644
index 0625cd1..0000000
--- a/src/mightypork/rogue/AppSubsystem.java
+++ /dev/null
@@ -1,209 +0,0 @@
-package mightypork.rogue;
-
-
-import java.util.HashSet;
-import java.util.Set;
-
-import mightypork.rogue.display.DisplaySystem;
-import mightypork.rogue.display.events.UpdateEvent;
-import mightypork.rogue.input.InputSystem;
-import mightypork.rogue.sounds.SoundSystem;
-import mightypork.utils.logging.Log;
-import mightypork.utils.patterns.Destroyable;
-import mightypork.utils.patterns.subscription.MessageBus;
-import mightypork.utils.time.Updateable;
-
-
-public abstract class AppSubsystem implements AppAccess, UpdateEvent.Listener, Updateable, Destroyable {
-
- private AppAccess app;
- private boolean wantUpdates;
- private boolean destroyed = false;
-
- /** Subsystem children subscribing to MessageBus */
- private Set