diff options
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; |