summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/rustanddust
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-02-21 23:13:41 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2016-02-21 23:13:41 +0100
commita787d5faf435eddf20270d7368c45d0f540e962e (patch)
treeaf5d83b7ff6357b0b921c7c0e2da8a846ff687d3 /core/src/ch/asynk/rustanddust
parent03ea31e2f3bdf571e446a5f0b8ee7e3d1aeb2ef9 (diff)
downloadRustAndDust-a787d5faf435eddf20270d7368c45d0f540e962e.zip
RustAndDust-a787d5faf435eddf20270d7368c45d0f540e962e.tar.gz
Menu: prepare can jump to another menu
Diffstat (limited to 'core/src/ch/asynk/rustanddust')
-rw-r--r--core/src/ch/asynk/rustanddust/menu/MainMenu.java2
-rw-r--r--core/src/ch/asynk/rustanddust/menu/MenuCtrl.java6
-rw-r--r--core/src/ch/asynk/rustanddust/menu/OptionsMenu.java2
-rw-r--r--core/src/ch/asynk/rustanddust/menu/PlayMenu.java2
-rw-r--r--core/src/ch/asynk/rustanddust/menu/TutorialsMenu.java2
5 files changed, 8 insertions, 6 deletions
diff --git a/core/src/ch/asynk/rustanddust/menu/MainMenu.java b/core/src/ch/asynk/rustanddust/menu/MainMenu.java
index 335e527..19567ce 100644
--- a/core/src/ch/asynk/rustanddust/menu/MainMenu.java
+++ b/core/src/ch/asynk/rustanddust/menu/MainMenu.java
@@ -83,7 +83,7 @@ public class MainMenu extends Patch implements MenuCtrl.Panel
}
@Override
- public boolean prepare() { return true; }
+ public MenuCtrl.MenuType prepare() { return MenuCtrl.MenuType.MAIN; }
@Override
public MenuCtrl.MenuType touch(float x, float y)
diff --git a/core/src/ch/asynk/rustanddust/menu/MenuCtrl.java b/core/src/ch/asynk/rustanddust/menu/MenuCtrl.java
index 6b7bfa8..56015fd 100644
--- a/core/src/ch/asynk/rustanddust/menu/MenuCtrl.java
+++ b/core/src/ch/asynk/rustanddust/menu/MenuCtrl.java
@@ -25,7 +25,7 @@ public class MenuCtrl implements Disposable, Drawable
interface Panel extends Disposable, Drawable
{
- public boolean prepare();
+ public MenuType prepare();
public void computePosition();
public MenuType touch(float x, float y);
}
@@ -60,8 +60,10 @@ public class MenuCtrl implements Disposable, Drawable
}
if (next != MenuType.NONE) {
- if (panels[next.i].prepare())
+ while(current != next) {
current = next;
+ next = panels[next.i].prepare();
+ }
}
return false;
diff --git a/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java b/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java
index e5401ff..04796a2 100644
--- a/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java
+++ b/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java
@@ -149,7 +149,7 @@ public class OptionsMenu extends Patch implements MenuCtrl.Panel
}
@Override
- public boolean prepare() { return true; }
+ public MenuCtrl.MenuType prepare() { return MenuCtrl.MenuType.OPTIONS; }
@Override
public MenuCtrl.MenuType touch(float x, float y)
diff --git a/core/src/ch/asynk/rustanddust/menu/PlayMenu.java b/core/src/ch/asynk/rustanddust/menu/PlayMenu.java
index 805efa0..0ed7f95 100644
--- a/core/src/ch/asynk/rustanddust/menu/PlayMenu.java
+++ b/core/src/ch/asynk/rustanddust/menu/PlayMenu.java
@@ -172,7 +172,7 @@ public class PlayMenu extends Patch implements MenuCtrl.Panel
}
@Override
- public boolean prepare() { return true; }
+ public MenuCtrl.MenuType prepare() { return MenuCtrl.MenuType.PLAY; }
@Override
public void dispose()
diff --git a/core/src/ch/asynk/rustanddust/menu/TutorialsMenu.java b/core/src/ch/asynk/rustanddust/menu/TutorialsMenu.java
index cae9b6c..5a8d03f 100644
--- a/core/src/ch/asynk/rustanddust/menu/TutorialsMenu.java
+++ b/core/src/ch/asynk/rustanddust/menu/TutorialsMenu.java
@@ -25,7 +25,7 @@ public class TutorialsMenu extends Patch implements MenuCtrl.Panel
}
@Override
- public boolean prepare() { return true; }
+ public MenuCtrl.MenuType prepare() { return MenuCtrl.MenuType.TUTORIALS; }
@Override
public void computePosition()