summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-02-22 10:38:50 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2016-02-22 10:48:33 +0100
commitf03589a9898592a5ce9f1192665a4030a148eddc (patch)
tree4820788e83840a19fa4244d8b580cc274236756b /core/src
parent68865bd48302bee6c4b533b499e0bfef10f5cdd6 (diff)
downloadRustAndDust-f03589a9898592a5ce9f1192665a4030a148eddc.zip
RustAndDust-f03589a9898592a5ce9f1192665a4030a148eddc.tar.gz
Menu: add boolean drag(float, float, int, int)
Diffstat (limited to 'core/src')
-rw-r--r--core/src/ch/asynk/rustanddust/menu/MainMenu.java3
-rw-r--r--core/src/ch/asynk/rustanddust/menu/MenuCtrl.java8
-rw-r--r--core/src/ch/asynk/rustanddust/menu/NewGameMenu.java3
-rw-r--r--core/src/ch/asynk/rustanddust/menu/OptionsMenu.java3
-rw-r--r--core/src/ch/asynk/rustanddust/menu/PlayMenu.java13
-rw-r--r--core/src/ch/asynk/rustanddust/menu/TutorialsMenu.java3
6 files changed, 27 insertions, 6 deletions
diff --git a/core/src/ch/asynk/rustanddust/menu/MainMenu.java b/core/src/ch/asynk/rustanddust/menu/MainMenu.java
index 7908c62..c51f73e 100644
--- a/core/src/ch/asynk/rustanddust/menu/MainMenu.java
+++ b/core/src/ch/asynk/rustanddust/menu/MainMenu.java
@@ -94,6 +94,9 @@ public class MainMenu extends Patch implements MenuCtrl.Panel
public MenuCtrl.MenuType prepare() { return MenuCtrl.MenuType.MAIN; }
@Override
+ public boolean drag(float x, float y, int dx, int dy) { return true; }
+
+ @Override
public MenuCtrl.MenuType touch(float x, float y)
{
int idx = -1;
diff --git a/core/src/ch/asynk/rustanddust/menu/MenuCtrl.java b/core/src/ch/asynk/rustanddust/menu/MenuCtrl.java
index 34d556d..49a959c 100644
--- a/core/src/ch/asynk/rustanddust/menu/MenuCtrl.java
+++ b/core/src/ch/asynk/rustanddust/menu/MenuCtrl.java
@@ -34,6 +34,7 @@ public class MenuCtrl implements Disposable, Drawable
public MenuType touch(float x, float y);
public String getAsk();
public void postAnswer(boolean ok);
+ public boolean drag(float x, float y, int dx, int dy);
}
public boolean visible;
@@ -57,6 +58,13 @@ public class MenuCtrl implements Disposable, Drawable
this.visible = true;
}
+ public boolean drag(float x, float y, int dx, int dy)
+ {
+ if (current == MenuType.PLAY)
+ panels[current.i].drag(x, y, dx, dy);
+ return true;
+ }
+
public boolean touch(float x, float y)
{
if (okCancel.hit(x, y)) {
diff --git a/core/src/ch/asynk/rustanddust/menu/NewGameMenu.java b/core/src/ch/asynk/rustanddust/menu/NewGameMenu.java
index 5bbef04..f91ed93 100644
--- a/core/src/ch/asynk/rustanddust/menu/NewGameMenu.java
+++ b/core/src/ch/asynk/rustanddust/menu/NewGameMenu.java
@@ -115,6 +115,9 @@ public class NewGameMenu extends Patch implements MenuCtrl.Panel
}
@Override
+ public boolean drag(float x, float y, int dx, int dy) { return true; }
+
+ @Override
public MenuCtrl.MenuType touch(float x, float y)
{
if (objectivesPanel.hit(x, y)) {
diff --git a/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java b/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java
index c99295e..8ec9b10 100644
--- a/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java
+++ b/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java
@@ -158,6 +158,9 @@ public class OptionsMenu extends Patch implements MenuCtrl.Panel
public MenuCtrl.MenuType prepare() { return MenuCtrl.MenuType.OPTIONS; }
@Override
+ public boolean drag(float x, float y, int dx, int dy) { return true; }
+
+ @Override
public MenuCtrl.MenuType touch(float x, float y)
{
if (okBtn.hit(x, y)) {
diff --git a/core/src/ch/asynk/rustanddust/menu/PlayMenu.java b/core/src/ch/asynk/rustanddust/menu/PlayMenu.java
index 54ba412..fb1c9ef 100644
--- a/core/src/ch/asynk/rustanddust/menu/PlayMenu.java
+++ b/core/src/ch/asynk/rustanddust/menu/PlayMenu.java
@@ -107,6 +107,13 @@ public class PlayMenu extends Patch implements MenuCtrl.Panel
}
@Override
+ public boolean drag(float x, float y, int dx, int dy)
+ {
+ if (!list.hit(x, y)) return false;
+ return list.drag(x, y, dx, dy);
+ }
+
+ @Override
public MenuCtrl.MenuType touch(float x, float y)
{
Integer i = getList().getIdx();
@@ -143,12 +150,6 @@ public class PlayMenu extends Patch implements MenuCtrl.Panel
return MenuCtrl.MenuType.NONE;
}
- public boolean drag(float x, float y, int dx, int dy)
- {
- if (!list.hit(x, y)) return false;
- return list.drag(x, y, dx, dy);
- }
-
@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 202cea7..e397660 100644
--- a/core/src/ch/asynk/rustanddust/menu/TutorialsMenu.java
+++ b/core/src/ch/asynk/rustanddust/menu/TutorialsMenu.java
@@ -63,6 +63,9 @@ public class TutorialsMenu extends Patch implements MenuCtrl.Panel
}
@Override
+ public boolean drag(float x, float y, int dx, int dy) { return true; }
+
+ @Override
public MenuCtrl.MenuType touch(float x, float y)
{
if (rect.contains(x, y) || okBtn.hit(x, y)) {