Compare commits

..

1 Commits

Author SHA1 Message Date
Peter Ferrie
3a980611d7
Merge d4d3c59b8c into b9ae1990e8 2024-03-15 10:32:05 -05:00

View File

@ -224,9 +224,7 @@ public class Joystick extends Device {
@ConfigurableField(name = "Use D-PAD", shortName = "dpad", description = "Physical game controller enable D-PAD")
public boolean useDPad = true;
@ConfigurableField(name = "Dead Zone", shortName = "deadZone", description = "Dead zone for joystick (0-1)")
public static float deadZone = 0.095f;
@ConfigurableField(name = "Sensitivity", shortName = "sensitivity", description = "Joystick value mutiplier")
public static float sensitivity = 1.1f;
public static float deadZone = 0.05f;
@ConfigurableField(name = "Rapid fire interval (ms)", shortName = "rapidfire", description = "Interval for rapid fire (ms)")
public int rapidFireInterval = 16;
@ -297,8 +295,8 @@ public class Joystick extends Device {
private void readJoystick() {
ticksSinceLastRead = 0;
if (useKeyboard) {
joyX = (leftPressed ? -128 : 0) + (rightPressed ? 256 : 128);
joyY = (upPressed ? -128 : 0) + (downPressed ? 256 : 128);
joyX = (leftPressed ? -128 : 0) + (rightPressed ? 255 : 128);
joyY = (upPressed ? -128 : 0) + (downPressed ? 255 : 128);
} else if (readGLFWJoystick()) {
float x = -0.5f;
float y = 0.5f;
@ -333,12 +331,6 @@ public class Joystick extends Device {
if (Math.abs(y) < deadZone) {
y = 0;
}
// We have to let the joystick go a little further in the positive direction
// because boulderdash is a little too sensitive!
x = Math.max(-1.0f, Math.min(1.1f, x * sensitivity));
y = Math.max(-1.0f, Math.min(1.1f, y * sensitivity));
joyX = (int) (x * 128.0 + 128.0);
joyY = (int) (y * 128.0 + 128.0);