summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/rustanddust
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-02-19 16:39:10 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2016-02-19 16:39:10 +0100
commit5453479d03a9f2852a5c623ab58454dbd417ed6b (patch)
tree263c9bb33b39cb6625bf51906a7af9c06b1acc2e /core/src/ch/asynk/rustanddust
parent3f565c31f0738b40e41471d33cb693da5d315056 (diff)
downloadRustAndDust-5453479d03a9f2852a5c623ab58454dbd417ed6b.zip
RustAndDust-5453479d03a9f2852a5c623ab58454dbd417ed6b.tar.gz
Widget: add setTop/BottomRight/Left()
Diffstat (limited to 'core/src/ch/asynk/rustanddust')
-rw-r--r--core/src/ch/asynk/rustanddust/game/hud/StatisticsPanel.java2
-rw-r--r--core/src/ch/asynk/rustanddust/menu/OptionsMenu.java4
-rw-r--r--core/src/ch/asynk/rustanddust/menu/PlayMenu.java4
-rw-r--r--core/src/ch/asynk/rustanddust/menu/ScenariosMenu.java4
-rw-r--r--core/src/ch/asynk/rustanddust/menu/TutorialsMenu.java2
-rw-r--r--core/src/ch/asynk/rustanddust/ui/OkCancel.java4
-rw-r--r--core/src/ch/asynk/rustanddust/ui/Patch.java10
-rw-r--r--core/src/ch/asynk/rustanddust/ui/Widget.java20
8 files changed, 30 insertions, 20 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/hud/StatisticsPanel.java b/core/src/ch/asynk/rustanddust/game/hud/StatisticsPanel.java
index 1711168..0f719e4 100644
--- a/core/src/ch/asynk/rustanddust/game/hud/StatisticsPanel.java
+++ b/core/src/ch/asynk/rustanddust/game/hud/StatisticsPanel.java
@@ -69,7 +69,7 @@ public class StatisticsPanel extends Patch
float y = position.getY(height);
setPosition(x, y, width, height);
- setBtnRight(okBtn);
+ setBottomRight(okBtn);
y += PADDING;
x += PADDING;
diff --git a/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java b/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java
index b947203..07eb232 100644
--- a/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java
+++ b/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java
@@ -132,8 +132,8 @@ public class OptionsMenu extends Patch
float y = position.getY(h);
setPosition(x, y, w, h);
- setBtnRight(okBtn);
- setBtnLeft(cancelBtn);
+ setBottomRight(okBtn);
+ setBottomLeft(cancelBtn);
y += PADDING;
x += PADDING + HSPACING;
diff --git a/core/src/ch/asynk/rustanddust/menu/PlayMenu.java b/core/src/ch/asynk/rustanddust/menu/PlayMenu.java
index 97fead0..d64f32c 100644
--- a/core/src/ch/asynk/rustanddust/menu/PlayMenu.java
+++ b/core/src/ch/asynk/rustanddust/menu/PlayMenu.java
@@ -92,8 +92,8 @@ public class PlayMenu extends Patch
float y = position.getY(h);
setPosition(x, y, w, h);
- setBtnRight(okBtn);
- setBtnLeft(cancelBtn);
+ setBottomRight(okBtn);
+ setBottomLeft(cancelBtn);
y += PADDING;
x += PADDING;
diff --git a/core/src/ch/asynk/rustanddust/menu/ScenariosMenu.java b/core/src/ch/asynk/rustanddust/menu/ScenariosMenu.java
index 75e2c90..a9eed52 100644
--- a/core/src/ch/asynk/rustanddust/menu/ScenariosMenu.java
+++ b/core/src/ch/asynk/rustanddust/menu/ScenariosMenu.java
@@ -70,8 +70,8 @@ public class ScenariosMenu extends Patch
float y = position.getY(h);
setPosition(x, y, w, h);
- setBtnRight(okBtn);
- setBtnLeft(cancelBtn);
+ setBottomRight(okBtn);
+ setBottomLeft(cancelBtn);
y += PADDING;
x += PADDING + HSPACING;
diff --git a/core/src/ch/asynk/rustanddust/menu/TutorialsMenu.java b/core/src/ch/asynk/rustanddust/menu/TutorialsMenu.java
index d5c38c9..ae770f4 100644
--- a/core/src/ch/asynk/rustanddust/menu/TutorialsMenu.java
+++ b/core/src/ch/asynk/rustanddust/menu/TutorialsMenu.java
@@ -45,7 +45,7 @@ public class TutorialsMenu extends Patch
float y = position.getY(h);
setPosition(x, y, w, h);
- setBtnRight(okBtn);
+ setBottomRight(okBtn);
y += PADDING;
x += PADDING;
diff --git a/core/src/ch/asynk/rustanddust/ui/OkCancel.java b/core/src/ch/asynk/rustanddust/ui/OkCancel.java
index 7b0bd1c..5036995 100644
--- a/core/src/ch/asynk/rustanddust/ui/OkCancel.java
+++ b/core/src/ch/asynk/rustanddust/ui/OkCancel.java
@@ -55,8 +55,8 @@ public class OkCancel extends Patch
float y = position.getY(height);
setPosition(x, y, width, height);
- setBtnRight(okBtn);
- setBtnLeft(cancelBtn);
+ setBottomRight(okBtn);
+ setBottomLeft(cancelBtn);
label.setPosition((x + PADDING), (y + PADDING + okBtn.getHeight() + VSPACING));
cancelBtn.visible = true;
visible = true;
diff --git a/core/src/ch/asynk/rustanddust/ui/Patch.java b/core/src/ch/asynk/rustanddust/ui/Patch.java
index f07c44d..acff791 100644
--- a/core/src/ch/asynk/rustanddust/ui/Patch.java
+++ b/core/src/ch/asynk/rustanddust/ui/Patch.java
@@ -25,14 +25,4 @@ public class Patch extends Widget
if (!visible) return;
patch.draw(batch, rect.x, rect.y, rect.width, rect.height);
}
-
- public void setBtnRight(Bg btn)
- {
- btn.setPosition((rect.x + rect.width - (btn.getWidth() * 0.666f)), (rect.y - (btn.getHeight() * 0.333f)));
- }
-
- public void setBtnLeft(Bg btn)
- {
- btn.setPosition((rect.x - (btn.getWidth() * 0.333f)), (rect.y - (btn.getHeight() * 0.333f)));
- }
}
diff --git a/core/src/ch/asynk/rustanddust/ui/Widget.java b/core/src/ch/asynk/rustanddust/ui/Widget.java
index 38a89ae..a776cf7 100644
--- a/core/src/ch/asynk/rustanddust/ui/Widget.java
+++ b/core/src/ch/asynk/rustanddust/ui/Widget.java
@@ -80,6 +80,26 @@ public abstract class Widget implements Disposable, Drawable
setPosition(x, y);
}
+ public void setTopRight(Widget btn)
+ {
+ btn.setPosition((getX() + getWidth() - (btn.getWidth() * 0.666f)), (getTop() - (btn.getHeight() * 0.666f)));
+ }
+
+ public void setTopLeft(Widget btn)
+ {
+ btn.setPosition((getX() - (btn.getWidth() * 0.333f)), (getTop() - (btn.getHeight() * 0.666f)));
+ }
+
+ public void setBottomRight(Widget btn)
+ {
+ btn.setPosition((getX() + getWidth() - (btn.getWidth() * 0.666f)), (getY() - (btn.getHeight() * 0.333f)));
+ }
+
+ public void setBottomLeft(Widget btn)
+ {
+ btn.setPosition((getX() - (btn.getWidth() * 0.333f)), (getY() - (btn.getHeight() * 0.333f)));
+ }
+
public boolean hit(float x, float y)
{
if (blocked || !visible) return false;