
com.flash3388.flashlib.hid.DualshockAxis Maven / Gradle / Ivy
package com.flash3388.flashlib.hid;
/**
* Represents an axis on an {@link DualshockController}. Can be used to retrieve axes instead of
* using raw index number, by using {@link DualshockController#getAxis(DualshockAxis)}:
*
* ds.getAxis(DualshockAxis.LeftStickX)
*
* As opposed to:
*
* ds.getAxis(0)
*
*
* @since FlashLib 3.0.0
*/
public enum DualshockAxis {
LeftStickX(0),
LeftStickY(1),
L2(2),
R2(3),
RightStickX(4),
RightStickY(5);
private final int mAxisIndex;
DualshockAxis(int axisIndex) {
mAxisIndex = axisIndex;
}
/**
* The index of the axis on the controller, such that:
*
* DualshockAxis dsaxis = ...
* ds.getAxis(dsaxis).equals(dsaxis.getAxis(dsaxis.axisIndex()))
*
* Is always true
*
* @return the index for this axis
*/
public int axisIndex() {
return mAxisIndex;
}
/**
* Gets the amount the amount of axes defined.
* Corresponds to:
*
* DualshockAxis.values().length
*
*
* @return amount of axes defined.
*/
public static int count() {
return values().length;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy