summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/subconscious/Game.java9
-rw-r--r--src/subconscious/graphics/GameWindow.java4
2 files changed, 10 insertions, 3 deletions
diff --git a/src/subconscious/Game.java b/src/subconscious/Game.java
index dc7d109..7fd8b33 100644
--- a/src/subconscious/Game.java
+++ b/src/subconscious/Game.java
@@ -24,6 +24,7 @@ public class Game {
private ArrayList<Actor> actors;
private ArrayList<Map> maps;
+ private Map currentMap;
public Game() {
this.setState(State.MENU);
@@ -39,6 +40,10 @@ public class Game {
this.setState(State.DREAM);
}
+ public Map getCurrentMap() {
+ return currentMap;
+ }
+
/* methods to manage the state */
public void setState(State state) {
if (this.state == state)
@@ -52,9 +57,11 @@ public class Game {
return this.state;
}
- public void waitStateChange() {
+ public State waitStateChange() {
while (!this.stateChanged);
this.stateChanged = false;
+
+ return this.state;
}
/* accessors */
diff --git a/src/subconscious/graphics/GameWindow.java b/src/subconscious/graphics/GameWindow.java
index ce99df5..19f8ce1 100644
--- a/src/subconscious/graphics/GameWindow.java
+++ b/src/subconscious/graphics/GameWindow.java
@@ -88,9 +88,9 @@ public class GameWindow extends JFrame implements ActionListener {
// ovserver of this.game
private void loop() {
while (this.game.isRunning()) {
- this.game.waitStateChange();
+ Game.State newState = this.game.waitStateChange();
- switch (this.game.getState()) {
+ switch (newState) {
case MENU:
this.loadMenu();
break;