diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-11-09 22:20:43 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-11-09 22:20:43 +0100 |
commit | 7a3d64b43b1e40c69a1efff8c487950960b27ea8 (patch) | |
tree | 8b491509741d26edea5f84536188f9816bf7844f /core/src/ch | |
parent | c781b30d6c7d642a2ab638be9aa0c8415f040297 (diff) | |
download | RustAndDust-7a3d64b43b1e40c69a1efff8c487950960b27ea8.zip RustAndDust-7a3d64b43b1e40c69a1efff8c487950960b27ea8.tar.gz |
ui: center ok/cancel buttons on box corners
Diffstat (limited to 'core/src/ch')
7 files changed, 11 insertions, 16 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/hud/EngagementPanel.java b/core/src/ch/asynk/rustanddust/game/hud/EngagementPanel.java index 790c8b5..e895c50 100644 --- a/core/src/ch/asynk/rustanddust/game/hud/EngagementPanel.java +++ b/core/src/ch/asynk/rustanddust/game/hud/EngagementPanel.java @@ -20,7 +20,6 @@ public class EngagementPanel extends Patch implements Animation private enum State { ROLL1, MOVE, ROLL2, RESULT }; public static int FLAG_HEIGHT = 24; - public static int OK_OFFSET = 10; public static int PADDING = 20; public static int VSPACING = 10; public static int HSPACING = 5; @@ -123,10 +122,10 @@ public class EngagementPanel extends Patch implements Animation float height = (okBtn.getHeight() + attackImg.getHeight() + defenseImg.getHeight() + (2 * VSPACING) + (2 * PADDING)); float width = (attackImg.getWidth() + (2 * d1Animation.getWidth()) + attack.getWidth() + w + (4 * HSPACING) + (2 * PADDING)); float x = position.getX(width); - float y = position.getY(height); + float y = position.getY(height) + (okBtn.getHeight() / 2.0f); setPosition(x, y, width, height); - okBtn.setPosition((x + width - okBtn.getWidth() + OK_OFFSET), (y - OK_OFFSET)); + okBtn.setPosition((x + width - (okBtn.getWidth() / 2.0f)), (y - (okBtn.getHeight() / 2.0f))); x = getX() + PADDING; y = getY() + PADDING; diff --git a/core/src/ch/asynk/rustanddust/game/hud/StatisticsPanel.java b/core/src/ch/asynk/rustanddust/game/hud/StatisticsPanel.java index 2e6546b..a0a27b6 100644 --- a/core/src/ch/asynk/rustanddust/game/hud/StatisticsPanel.java +++ b/core/src/ch/asynk/rustanddust/game/hud/StatisticsPanel.java @@ -13,7 +13,6 @@ import ch.asynk.rustanddust.ui.Position; public class StatisticsPanel extends Patch { - public static int OK_OFFSET = 10; public static int PADDING = 20; public static int VSPACING = 10; public static int HSPACING = 10; @@ -63,7 +62,7 @@ public class StatisticsPanel extends Patch float y = position.getY(height); setPosition(x, y, width, height); - okBtn.setPosition((x + width - okBtn.getWidth() + OK_OFFSET), (y - OK_OFFSET)); + okBtn.setPosition((x + width - (okBtn.getWidth() / 2.0f)), (y - (okBtn.getHeight() / 2.0f))); 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 d532877..a8e964a 100644 --- a/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java +++ b/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java @@ -15,7 +15,6 @@ import ch.asynk.rustanddust.RustAndDust; public class OptionsMenu extends Patch { public static int PADDING = 40; - public static int OK_PADDING = 10; public static int OPT_PADDING = 10; public static int TITLE_PADDING = 30; public static int VSPACING = 5; @@ -142,7 +141,7 @@ public class OptionsMenu extends Patch float y = position.getY(h); setPosition(x, y, w, h); - okBtn.setPosition((x + w - okBtn.getWidth() + OK_PADDING), (y - OK_PADDING)); + okBtn.setPosition((x + w - (okBtn.getWidth() / 2.0f)), (y - (okBtn.getHeight() / 2.0f))); 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 1f1439d..42f4ae1 100644 --- a/core/src/ch/asynk/rustanddust/menu/PlayMenu.java +++ b/core/src/ch/asynk/rustanddust/menu/PlayMenu.java @@ -13,7 +13,6 @@ import ch.asynk.rustanddust.RustAndDust; public class PlayMenu extends Patch { public static int PADDING = 40; - public static int BTN_PADDING = 10; public static int TITLE_PADDING = 30; public static int VSPACING = 20; @@ -90,8 +89,8 @@ public class PlayMenu extends Patch float y = position.getY(h); setPosition(x, y, w, h); - okBtn.setPosition((x + w - okBtn.getWidth() + BTN_PADDING), (y - BTN_PADDING)); - cancelBtn.setPosition((x - BTN_PADDING), okBtn.getY()); + okBtn.setPosition((x + w - (okBtn.getWidth() / 2.0f)), (y - (okBtn.getHeight() / 2.0f))); + cancelBtn.setPosition((x - (cancelBtn.getWidth() / 2.0f)), okBtn.getY()); 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 d5b99ed..23e6b38 100644 --- a/core/src/ch/asynk/rustanddust/menu/ScenariosMenu.java +++ b/core/src/ch/asynk/rustanddust/menu/ScenariosMenu.java @@ -72,8 +72,8 @@ public class ScenariosMenu extends Patch float y = position.getY(h); setPosition(x, y, w, h); - okBtn.setPosition((x + w - okBtn.getWidth() + BTN_PADDING), (y - BTN_PADDING)); - cancelBtn.setPosition((x - BTN_PADDING), okBtn.getY()); + okBtn.setPosition((x + w - (okBtn.getWidth() / 2.0f)), (y - (okBtn.getHeight() / 2.0f))); + cancelBtn.setPosition((x - (cancelBtn.getWidth() / 2.0f)), okBtn.getY()); 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 5f1242f..c1a442e 100644 --- a/core/src/ch/asynk/rustanddust/menu/TutorialsMenu.java +++ b/core/src/ch/asynk/rustanddust/menu/TutorialsMenu.java @@ -12,7 +12,6 @@ import ch.asynk.rustanddust.RustAndDust; public class TutorialsMenu extends Patch { public static int PADDING = 40; - public static int OK_PADDING = 10; public static int TITLE_PADDING = 30; private final RustAndDust game; @@ -50,7 +49,7 @@ public class TutorialsMenu extends Patch float y = position.getY(h); setPosition(x, y, w, h); - okBtn.setPosition((x + w - okBtn.getWidth() + OK_PADDING), (y - OK_PADDING)); + okBtn.setPosition((x + w - (okBtn.getWidth() / 2.0f)), (y - (okBtn.getHeight() / 2.0f))); 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 f30a65b..a313173 100644 --- a/core/src/ch/asynk/rustanddust/ui/OkCancel.java +++ b/core/src/ch/asynk/rustanddust/ui/OkCancel.java @@ -54,8 +54,8 @@ public class OkCancel extends Patch float y = position.getY(height); setPosition(x, y, width, height); - okBtn.setPosition((x + width - okBtn.getWidth() - PADDING), (y + PADDING)); - cancelBtn.setPosition((x + PADDING), okBtn.getY()); + okBtn.setPosition((x + width - (okBtn.getWidth() / 2.0f)), (y - (okBtn.getHeight() / 2.0f))); + cancelBtn.setPosition((x - (cancelBtn.getWidth() / 2.0f)), (y - (cancelBtn.getHeight() / 2.0f))); label.setPosition((x + PADDING), (y + PADDING + okBtn.getHeight() + VSPACING)); cancelBtn.visible = true; visible = true; |