diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/src/ch/asynk/rustanddust/menu/OptionsMenu.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java b/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java index f56d30b..05ba06f 100644 --- a/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java +++ b/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java @@ -35,8 +35,11 @@ public class OptionsMenu extends Patch private Label title; private Label fxVolume; private Label fxVolumeValue; + private Label graphics; + private Label graphicsValue; private Label [] checkLabels; private int fxVolumeIdx; + private int graphicsIdx; private boolean [] checkValues; protected Bg okBtn; protected Bg cancelBtn; @@ -53,6 +56,9 @@ public class OptionsMenu extends Patch this.fxVolume = new Label(font); this.fxVolume.write("Fx Volume"); this.fxVolumeValue = new Label(font); + this.graphics = new Label(font); + this.graphics.write("Graphics"); + this.graphicsValue = new Label(font); this.checkValues = new boolean[checkStrings.length]; this.checkLabels = new Label[checkStrings.length]; for (int i = 0; i < checkLabels.length; i++) { @@ -77,6 +83,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() @@ -87,6 +95,7 @@ public class OptionsMenu extends Patch game.config.showEnemyPossibilities = checkValues[1]; game.config.debug = checkValues[0]; game.config.fxVolume = (fxVolumeIdx / 10.0f); + game.config.graphics = game.config.graphics.get(graphicsIdx); return true; } @@ -97,11 +106,18 @@ public class OptionsMenu extends Patch fxVolumeValue.write(fxStrings[fxVolumeIdx], fxVolumeValue.getX(), fxVolumeValue.getY()); } + private void cycleGraphics() + { + graphicsIdx = game.config.graphics.get(graphicsIdx).next().i; + graphicsValue.write(game.config.graphics.get(graphicsIdx).s, graphicsValue.getX(), graphicsValue.getY()); + } + public void setPosition() { float h = (title.getHeight() + TITLE_PADDING + ((checkLabels.length - 1) * VSPACING) + (2 * PADDING)); for (int i = 0; i < checkLabels.length; i++) h += checkLabels[i].getHeight(); + h += (graphics.getHeight() + VSPACING); h += (fxVolume.getHeight() + VSPACING); float w = title.getWidth(); @@ -122,6 +138,9 @@ public class OptionsMenu extends Patch y += PADDING; x += PADDING + HSPACING; + graphics.setPosition(x, y); + graphicsValue.setPosition((x + graphics.getWidth() + OPT_PADDING), y); + y += (VSPACING + graphics.getHeight()); fxVolume.setPosition(x, y); fxVolumeValue.setPosition((x + fxVolume.getWidth() + OPT_PADDING), y); y += (VSPACING + fxVolume.getHeight()); @@ -146,6 +165,8 @@ public class OptionsMenu extends Patch return true; } else if (fxVolume.hit(x, y) || fxVolumeValue.hit(x, y)) { cycleFxVolume(); + } else if (graphics.hit(x, y) || graphicsValue.hit(x, y)) { + cycleGraphics(); } else { for (int i = 0; i < checkLabels.length; i++) { if (checkLabels[i].hit(x, y)) @@ -165,6 +186,8 @@ public class OptionsMenu extends Patch cancelBtn.dispose(); fxVolume.dispose(); fxVolumeValue.dispose(); + graphics.dispose(); + graphicsValue.dispose(); for (int i = 0; i < checkLabels.length; i++) checkLabels[i].dispose(); } @@ -179,6 +202,8 @@ public class OptionsMenu extends Patch cancelBtn.draw(batch); fxVolume.draw(batch); fxVolumeValue.draw(batch); + graphics.draw(batch); + graphicsValue.draw(batch); for (int i = 0; i < checkLabels.length; i++) { Label l = checkLabels[i]; l.draw(batch); |