Fix[controls]: joystick sprint on lock

This commit is contained in:
Mathias-Boulay 2023-05-15 22:46:30 +02:00 committed by ArtDev
parent 7b02277186
commit f0e9f842ad

View File

@ -39,7 +39,7 @@ public class ControlJoystick extends JoystickView implements ControlInterface {
private int mCurrentDirectionInt = GamepadJoystick.DIRECTION_NONE;
// Directions keycode
private final int[] mDirectionForwardLock = new int[]{LwjglGlfwKeycode.GLFW_KEY_W, LwjglGlfwKeycode.GLFW_KEY_LEFT_CONTROL};
private final int[] mDirectionForwardLock = new int[]{LwjglGlfwKeycode.GLFW_KEY_LEFT_CONTROL};
private final int[] mDirectionForward = new int[]{LwjglGlfwKeycode.GLFW_KEY_W};
private final int[] mDirectionRight = new int[]{LwjglGlfwKeycode.GLFW_KEY_D};
private final int[] mDirectionBackward = new int[]{LwjglGlfwKeycode.GLFW_KEY_S};
@ -69,13 +69,7 @@ public class ControlJoystick extends JoystickView implements ControlInterface {
@Override
public void onForwardLock(boolean isLocked) {
mLastDirectionInt = mCurrentDirectionInt;
mCurrentDirectionInt = DIRECTION_FORWARD_LOCK;
if(mLastDirectionInt != mCurrentDirectionInt){
sendDirectionalKeycode(mLastDirectionInt, false);
sendDirectionalKeycode(mCurrentDirectionInt, true);
}
sendInput(mDirectionForwardLock, isLocked);
}
});
}