mirror of
https://github.com/TeamMidnightDust/MidnightControls.git
synced 2025-12-16 08:35:10 +01:00
Add methods for instantiating storage
This commit is contained in:
@@ -21,11 +21,14 @@ public class AxisStorage {
|
||||
public final ButtonState buttonState;
|
||||
|
||||
// Used for joysticks
|
||||
public AxisStorage(int axis, float value) {
|
||||
this(axis, value, isLeftAxis(axis) ? MidnightControlsConfig.leftDeadZone : MidnightControlsConfig.rightDeadZone);
|
||||
public static AxisStorage of(int axis, float value) {
|
||||
return new AxisStorage(axis, value, isLeftAxis(axis) ? MidnightControlsConfig.leftDeadZone : MidnightControlsConfig.rightDeadZone);
|
||||
}
|
||||
public static AxisStorage of(int axis, float value, double deadZone) {
|
||||
return new AxisStorage(axis, value, deadZone);
|
||||
}
|
||||
|
||||
public AxisStorage(int axis, float value, double deadZone) {
|
||||
private AxisStorage(int axis, float value, double deadZone) {
|
||||
this.axis = axis;
|
||||
this.deadZone = deadZone;
|
||||
|
||||
|
||||
@@ -9,7 +9,11 @@ public class ButtonStorage {
|
||||
public final int button;
|
||||
public final ButtonState state;
|
||||
|
||||
public ButtonStorage(int button, ButtonState state) {
|
||||
public static ButtonStorage of(int button, ButtonState state) {
|
||||
return new ButtonStorage(button, state);
|
||||
}
|
||||
|
||||
private ButtonStorage(int button, ButtonState state) {
|
||||
this.button = button;
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user