#42: Fixed joystick emulation of keyboard

This commit is contained in:
Brendan Robert 2024-07-09 21:20:51 -05:00
parent 6d1a5e7edd
commit 4c6a8f976c

View File

@ -579,7 +579,9 @@ public class Joystick extends Device {
@InvokableAction(name = "Left", category = "joystick", defaultKeyMapping = "left", notifyOnRelease = true) @InvokableAction(name = "Left", category = "joystick", defaultKeyMapping = "left", notifyOnRelease = true)
public boolean joystickLeft(boolean pressed) { public boolean joystickLeft(boolean pressed) {
if (!isAttached || !useKeyboard) { System.out.println("LEFT "+pressed);
if (!useKeyboard) {
System.out.println("(ignored)");
return false; return false;
} }
leftPressed = pressed; leftPressed = pressed;
@ -591,7 +593,9 @@ public class Joystick extends Device {
@InvokableAction(name = "Right", category = "joystick", defaultKeyMapping = "right", notifyOnRelease = true) @InvokableAction(name = "Right", category = "joystick", defaultKeyMapping = "right", notifyOnRelease = true)
public boolean joystickRight(boolean pressed) { public boolean joystickRight(boolean pressed) {
if (!isAttached || !useKeyboard) { System.out.println("RIGHT "+pressed);
if (!useKeyboard) {
System.out.println("(ignored)");
return false; return false;
} }
rightPressed = pressed; rightPressed = pressed;
@ -603,7 +607,9 @@ public class Joystick extends Device {
@InvokableAction(name = "Up", category = "joystick", defaultKeyMapping = "up", notifyOnRelease = true) @InvokableAction(name = "Up", category = "joystick", defaultKeyMapping = "up", notifyOnRelease = true)
public boolean joystickUp(boolean pressed) { public boolean joystickUp(boolean pressed) {
if (!isAttached || !useKeyboard) { System.out.println("UP!");
if (!useKeyboard) {
System.out.println("(ignored)");
return false; return false;
} }
upPressed = pressed; upPressed = pressed;
@ -615,7 +621,9 @@ public class Joystick extends Device {
@InvokableAction(name = "Down", category = "joystick", defaultKeyMapping = "down", notifyOnRelease = true) @InvokableAction(name = "Down", category = "joystick", defaultKeyMapping = "down", notifyOnRelease = true)
public boolean joystickDown(boolean pressed) { public boolean joystickDown(boolean pressed) {
if (!isAttached || !useKeyboard) { System.out.println("DOWN!");
if (!useKeyboard) {
System.out.println("(ignored)");
return false; return false;
} }
downPressed = pressed; downPressed = pressed;