add spinnerdelay option

This commit is contained in:
yugecin 2016-10-01 13:44:34 +02:00
parent eee65a589e
commit be599885f5
3 changed files with 26 additions and 1 deletions

View File

@ -59,6 +59,7 @@ import yugecin.opsudance.MoverDirection;
import yugecin.opsudance.ObjectColorOverrides;
import yugecin.opsudance.Pippi;
import yugecin.opsudance.movers.factories.AutoMoverFactory;
import yugecin.opsudance.spinners.Spinner;
/**
* Handles all user options.
@ -635,6 +636,25 @@ public class Options {
}
},
DANCE_SPINNER_DELAY ("Spinner delay", "SpinnerDelay", "Fiddle with this if spinner goes too fast. Some spinners don't use delays.", Spinner.DELAY, 0, 20) {
@Override
public String getValueString() {
return String.format("%d frames", val);
}
@Override
public void drag(GameContainer container, int d) {
super.drag(container, d);
Spinner.DELAY = val;
}
@Override
public void read(String s) {
super.read(s);
Spinner.DELAY = val;
}
},
DANCE_LAZY_SLIDERS ("Lazy sliders", "LazySliders", "Don't do short sliders", Dancer.LAZY_SLIDERS) {
@Override
public void click(GameContainer container) {

View File

@ -109,6 +109,7 @@ public class OptionsMenu extends BasicGameState {
GameOption.DANCE_MOVER,
GameOption.DANCE_MOVER_DIRECTION,
GameOption.DANCE_SPINNER,
GameOption.DANCE_SPINNER_DELAY,
GameOption.DANCE_LAZY_SLIDERS,
GameOption.DANCE_CIRCLE_STREAMS,
GameOption.DANCE_ONLY_CIRCLE_STACKS,

View File

@ -22,6 +22,7 @@ public abstract class Spinner {
private double[][] points;
private int length;
private int index;
private int delay;
public static int DELAY = 3;
public abstract void init();
@ -32,7 +33,10 @@ public abstract class Spinner {
}
public double[] getPoint() {
index = ++index % length;
if (delay++ < DELAY) {
index = ++index % length;
delay = 0;
}
return points[index];
}