forked from Clones/Controlify
joystick support
This commit is contained in:
@ -0,0 +1,35 @@
|
||||
package dev.isxander.controlify.controller.gamepad;
|
||||
|
||||
import dev.isxander.controlify.controller.ControllerConfig;
|
||||
|
||||
public class GamepadConfig extends ControllerConfig {
|
||||
public float leftStickDeadzoneX = 0.2f;
|
||||
public float leftStickDeadzoneY = 0.2f;
|
||||
|
||||
public float rightStickDeadzoneX = 0.2f;
|
||||
public float rightStickDeadzoneY = 0.2f;
|
||||
|
||||
public BuiltinGamepadTheme theme = BuiltinGamepadTheme.DEFAULT;
|
||||
|
||||
@Override
|
||||
public void setDeadzone(int axis, float deadzone) {
|
||||
switch (axis) {
|
||||
case 0 -> leftStickDeadzoneX = deadzone;
|
||||
case 1 -> leftStickDeadzoneY = deadzone;
|
||||
case 2 -> rightStickDeadzoneX = deadzone;
|
||||
case 3 -> rightStickDeadzoneY = deadzone;
|
||||
default -> throw new IllegalArgumentException("Unknown axis: " + axis);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDeadzone(int axis) {
|
||||
return switch (axis) {
|
||||
case 0 -> leftStickDeadzoneX;
|
||||
case 1 -> leftStickDeadzoneY;
|
||||
case 2 -> rightStickDeadzoneX;
|
||||
case 3 -> rightStickDeadzoneY;
|
||||
default -> throw new IllegalArgumentException("Unknown axis: " + axis);
|
||||
};
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user