summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-11-10 14:58:16 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-11-10 14:58:16 +0100
commit40c3467c6c6838e347f0ea90703643d51de4a481 (patch)
treefc774f040a4ccc1631759bf203a843cc6fd6fbe8 /core
parent31defb2803f5c45b28d08bfd9e0c07c90df00ed8 (diff)
downloadRustAndDust-40c3467c6c6838e347f0ea90703643d51de4a481.zip
RustAndDust-40c3467c6c6838e347f0ea90703643d51de4a481.tar.gz
OptionsMenu: fxVolume changes are cancel on ... cancel
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/rustanddust/menu/OptionsMenu.java15
1 files changed, 7 insertions, 8 deletions
diff --git a/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java b/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java
index 7726dad..52b0d78 100644
--- a/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java
+++ b/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java
@@ -42,6 +42,7 @@ public class OptionsMenu extends Patch
private Label graphics;
private Label graphicsValue;
private Label [] checkLabels;
+ private int fxVolumeIdx;
private boolean [] checkValues;
private OkCancel okCancel;
protected Bg okBtn;
@@ -60,7 +61,6 @@ public class OptionsMenu extends Patch
this.fxVolume = new Label(font);
this.fxVolume.write("Fx Volume");
this.fxVolumeValue = new Label(font);
- this.fxVolumeValue.write(fxStrings[(int) (game.config.fxVolume * 10)]);
this.graphics = new Label(font);
this.graphics.write("Graphics");
this.graphicsValue = new Label(font);
@@ -89,6 +89,8 @@ public class OptionsMenu extends Patch
checkValues[2] = game.config.canCancel;
checkValues[1] = game.config.mustValidate;
checkValues[0] = game.config.debug;
+ fxVolumeIdx = (int) (game.config.fxVolume * 10);
+ fxVolumeValue.write(fxStrings[fxVolumeIdx], fxVolumeValue.getX(), fxVolumeValue.getY());
}
private boolean apply()
@@ -100,18 +102,15 @@ public class OptionsMenu extends Patch
game.config.canCancel = checkValues[2];
game.config.mustValidate = checkValues[1];
game.config.debug = checkValues[0];
+ game.config.fxVolume = (fxVolumeIdx / 10.0f);
return true;
}
private void cycleFxVolume()
{
- int i = (int) (game.config.fxVolume * 10) + 1;
- if (i > 10) i = 0;
- float fx = fxVolumeValue.getX();
- float fy = fxVolumeValue.getY();
- fxVolumeValue.write(fxStrings[i]);
- fxVolumeValue.setPosition(fx, fy);
- game.config.fxVolume = (i / 10f);
+ fxVolumeIdx += 1;
+ if (fxVolumeIdx > 10) fxVolumeIdx = 0;
+ fxVolumeValue.write(fxStrings[fxVolumeIdx], fxVolumeValue.getX(), fxVolumeValue.getY());
}
private void cycleGraphics()