Merge branch 'spinners' into master

This commit is contained in:
yugecin 2016-10-01 13:44:54 +02:00
commit 376cb558cb
3 changed files with 26 additions and 1 deletions

View File

@ -56,6 +56,7 @@ import com.sun.jna.platform.win32.Win32Exception;
import com.sun.jna.platform.win32.WinReg;
import yugecin.opsudance.*;
import yugecin.opsudance.movers.factories.AutoMoverFactory;
import yugecin.opsudance.spinners.Spinner;
/**
* Handles all user options.
@ -632,6 +633,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];
}