summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-11-10 14:57:23 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-11-10 14:57:23 +0100
commit31defb2803f5c45b28d08bfd9e0c07c90df00ed8 (patch)
tree6730ac49ac4236adf4a49cbd9513b18c18e09fbf /core/src/ch/asynk
parent126621e9a55806b13e45a2f6e37fae4cbf2da4b6 (diff)
downloadRustAndDust-31defb2803f5c45b28d08bfd9e0c07c90df00ed8.zip
RustAndDust-31defb2803f5c45b28d08bfd9e0c07c90df00ed8.tar.gz
OptionsMenu: add cancel button
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r--core/src/ch/asynk/rustanddust/menu/OptionsMenu.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java b/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java
index 85e3d00..7726dad 100644
--- a/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java
+++ b/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java
@@ -45,6 +45,7 @@ public class OptionsMenu extends Patch
private boolean [] checkValues;
private OkCancel okCancel;
protected Bg okBtn;
+ protected Bg cancelBtn;
public OptionsMenu(RustAndDust game, BitmapFont font, TextureAtlas atlas)
{
@@ -53,6 +54,7 @@ public class OptionsMenu extends Patch
this.font = font;
this.okCancel = new OkCancel(font, atlas);
this.okBtn = new Bg(atlas.findRegion("ok"));
+ this.cancelBtn = new Bg(atlas.findRegion("cancel"));
this.title = new Label(font);
this.title.write("- Options");
this.fxVolume = new Label(font);
@@ -142,6 +144,7 @@ public class OptionsMenu extends Patch
setPosition(x, y, w, h);
setBtnRight(okBtn);
+ setBtnLeft(cancelBtn);
y += PADDING;
x += PADDING + HSPACING;
@@ -174,6 +177,9 @@ public class OptionsMenu extends Patch
if (okBtn.hit(x, y)) {
return apply();
+ } else if (cancelBtn.hit(x, y)) {
+ getValues();
+ return true;
} else if (fxVolume.hit(x, y) || fxVolumeValue.hit(x, y)) {
cycleFxVolume();
} else if (graphics.hit(x, y) || graphicsValue.hit(x, y)) {
@@ -194,6 +200,7 @@ public class OptionsMenu extends Patch
super.dispose();
title.dispose();
okBtn.dispose();
+ cancelBtn.dispose();
okCancel.dispose();
fxVolume.dispose();
fxVolumeValue.dispose();
@@ -212,6 +219,7 @@ public class OptionsMenu extends Patch
super.draw(batch);
title.draw(batch);
okBtn.draw(batch);
+ cancelBtn.draw(batch);
fxVolume.draw(batch);
fxVolumeValue.draw(batch);
graphics.draw(batch);