add aggressiveness in optionmenu

This commit is contained in:
yugecin 2016-12-04 13:37:00 +01:00
parent f95d1c4669
commit 3c15aeb9bd
2 changed files with 11 additions and 1 deletions

View File

@ -56,6 +56,7 @@ import com.sun.jna.platform.win32.Advapi32Util;
import com.sun.jna.platform.win32.Win32Exception; import com.sun.jna.platform.win32.Win32Exception;
import com.sun.jna.platform.win32.WinReg; import com.sun.jna.platform.win32.WinReg;
import yugecin.opsudance.*; import yugecin.opsudance.*;
import yugecin.opsudance.movers.QuadraticBezierMover;
import yugecin.opsudance.movers.factories.AutoMoverFactory; import yugecin.opsudance.movers.factories.AutoMoverFactory;
import yugecin.opsudance.spinners.Spinner; import yugecin.opsudance.spinners.Spinner;
import yugecin.opsudance.ui.SBOverlay; import yugecin.opsudance.ui.SBOverlay;
@ -623,6 +624,14 @@ public class Options {
} }
}, },
DANCE_QUAD_BEZ_AGRESSIVE ("Quadratic Bezier aggressiveness", "QuadBezAgr", "AKA initial D factor", 500, 0, 2000) {
@Override
public void read(String s) {
super.read(s);
QuadraticBezierMover.aggressiveness = val / 10;
}
},
DANCE_MOVER_DIRECTION ("Mover direction", "MoverDirection", "The direction the mover goes" ) { DANCE_MOVER_DIRECTION ("Mover direction", "MoverDirection", "The direction the mover goes" ) {
@Override @Override
public String getValueString() { public String getValueString() {

View File

@ -24,6 +24,7 @@ import java.awt.*;
public class QuadraticBezierMover extends Mover { public class QuadraticBezierMover extends Mover {
public static int aggressiveness = 50;
private static Point p; private static Point p;
private static double prevspeed; private static double prevspeed;
@ -50,7 +51,7 @@ public class QuadraticBezierMover extends Mover {
//double speed = dist / 10 + dist * (Math.PI - angDiff) / Math.PI; //double speed = dist / 10 + dist * (Math.PI - angDiff) / Math.PI;
p.x = (int) (startX + Math.cos(startAngle) * prevspeed); p.x = (int) (startX + Math.cos(startAngle) * prevspeed);
p.y = (int) (startY + Math.sin(startAngle) * prevspeed); p.y = (int) (startY + Math.sin(startAngle) * prevspeed);
prevspeed = (dist / totalTime) * 50; prevspeed = (dist / totalTime) * aggressiveness;
} }
@Override @Override