From 36d758ebb862e0608ddbf53ce4876af844e9a783 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Tue, 10 Nov 2015 15:56:18 +0100 Subject: OptionsMenu: graphics changes are canceld on ... cancel --- core/src/ch/asynk/rustanddust/menu/OptionsMenu.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java b/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java index 52b0d78..a172a8d 100644 --- a/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java +++ b/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java @@ -43,6 +43,7 @@ public class OptionsMenu extends Patch private Label graphicsValue; private Label [] checkLabels; private int fxVolumeIdx; + private int graphicsIdx; private boolean [] checkValues; private OkCancel okCancel; protected Bg okBtn; @@ -64,7 +65,6 @@ public class OptionsMenu extends Patch this.graphics = new Label(font); this.graphics.write("Graphics"); this.graphicsValue = new Label(font); - this.graphicsValue.write(game.config.graphics.s); this.checkValues = new boolean[checkStrings.length]; this.checkLabels = new Label[checkStrings.length]; for (int i = 0; i < checkLabels.length; i++) { @@ -91,6 +91,8 @@ public class OptionsMenu extends Patch checkValues[0] = game.config.debug; fxVolumeIdx = (int) (game.config.fxVolume * 10); fxVolumeValue.write(fxStrings[fxVolumeIdx], fxVolumeValue.getX(), fxVolumeValue.getY()); + graphicsIdx = game.config.graphics.i; + graphicsValue.write(game.config.graphics.s, graphicsValue.getX(), graphicsValue.getY()); } private boolean apply() @@ -103,6 +105,7 @@ public class OptionsMenu extends Patch game.config.mustValidate = checkValues[1]; game.config.debug = checkValues[0]; game.config.fxVolume = (fxVolumeIdx / 10.0f); + game.config.graphics = game.config.graphics.get(graphicsIdx); return true; } @@ -115,11 +118,8 @@ public class OptionsMenu extends Patch private void cycleGraphics() { - game.config.graphics = game.config.graphics.next(); - float fx = graphicsValue.getX(); - float fy = graphicsValue.getY(); - graphicsValue.write(game.config.graphics.s); - graphicsValue.setPosition(fx, fy); + graphicsIdx = game.config.graphics.get(graphicsIdx).next().i; + graphicsValue.write(game.config.graphics.get(graphicsIdx).s, graphicsValue.getX(), graphicsValue.getY()); } public void setPosition() -- cgit v1.1-2-g2b99