public class XboxUiInput extends XboxGamePadAdapter implements GamePadUiInput<XboxButton>
XboxGamePad
implementation of GamePadUiInput
Constructor and Description |
---|
XboxUiInput(UiContainer uiContainer) |
Modifier and Type | Method and Description |
---|---|
boolean |
buttonDown(XboxGamePad controller,
XboxButton button)
Called when a button is pressed down
|
boolean |
buttonUp(XboxGamePad controller,
XboxButton button)
Called when a button is released
|
void |
disable()
Disables this gamepad input for the
UiContainer |
void |
dispose()
Cleans up and de-registers this instance from the associated
UiContainer |
void |
enable()
Enables this gamepad input for the
UiContainer |
boolean |
equals(java.lang.Object obj) |
XboxButton |
getActionButton()
Returns the button used to trigger
Actionable instances |
java.lang.String |
getId()
Returns the unique id of this
GamePadUiInput |
int |
hashCode() |
boolean |
isEnabled()
Returns if the gamepad input is enabled for the
UiContainer |
boolean |
isNavigateWithDPad()
Returns if
UiNavigation events should be triggered by the D-PAD |
boolean |
leftStickXMoved(XboxGamePad controller,
float value)
Called when left stick moves along its X axis
|
boolean |
leftStickYMoved(XboxGamePad controller,
float value)
Called when left stick moves along its Y axis
|
void |
setActionButton(XboxButton actionButton)
Sets the button used for triggering
Actionable instances |
void |
setDebug(boolean debug) |
void |
setNavigateWithDPad(boolean navigateWithDPad)
Sets if
UiNavigation events should be triggered by the D-PAD |
void |
setStickRepeatTimer(float stickRepeatTimer)
Sets the amount of time in seconds before the left stick is considered repeating a navigation direction
|
void |
setStickThreshold(float stickThreshold)
Sets the threshold for stick values before the input is considered as a navigation direction press
|
void |
update(float delta)
Updates the input for repeating presses
|
connected, disconnected, leftTriggerMoved, rightStickXMoved, rightStickYMoved, rightTriggerMoved
public XboxUiInput(UiContainer uiContainer)
public void update(float delta)
GamePadUiInput
update
in interface GamePadUiInput<XboxButton>
delta
- The time since the last frame (in seconds)public boolean leftStickXMoved(XboxGamePad controller, float value)
XboxGamePadListener
leftStickXMoved
in interface XboxGamePadListener
leftStickXMoved
in class XboxGamePadAdapter
controller
- The gamepad that this event came fromvalue
- ~-1f at left, ~0f at center, ~1f at right (values may never be
accurate due to dead zones, apply a DeadZone
to the
gamepad instance to correct this)public boolean leftStickYMoved(XboxGamePad controller, float value)
XboxGamePadListener
leftStickYMoved
in interface XboxGamePadListener
leftStickYMoved
in class XboxGamePadAdapter
controller
- The gamepad that this event came fromvalue
- ~-1f at top, ~0f at center, ~1f at bottom (values may never be
accurate due to dead zones, apply a DeadZone
to the
gamepad instance to correct this)public boolean buttonDown(XboxGamePad controller, XboxButton button)
XboxGamePadListener
buttonDown
in interface XboxGamePadListener
buttonDown
in class XboxGamePadAdapter
controller
- The gamePad that this event came frombutton
- The button that was pressedpublic boolean buttonUp(XboxGamePad controller, XboxButton button)
XboxGamePadListener
buttonUp
in interface XboxGamePadListener
buttonUp
in class XboxGamePadAdapter
controller
- The gamepad that this event came frombutton
- The button that was releasedpublic boolean isEnabled()
GamePadUiInput
UiContainer
isEnabled
in interface GamePadUiInput<XboxButton>
public void enable()
GamePadUiInput
UiContainer
enable
in interface GamePadUiInput<XboxButton>
public void disable()
GamePadUiInput
UiContainer
disable
in interface GamePadUiInput<XboxButton>
public void setStickRepeatTimer(float stickRepeatTimer)
stickRepeatTimer
- Default value is 0.25 secondspublic void setStickThreshold(float stickThreshold)
stickThreshold
- Default value is 0.25public boolean isNavigateWithDPad()
UiNavigation
events should be triggered by the D-PADpublic void setNavigateWithDPad(boolean navigateWithDPad)
UiNavigation
events should be triggered by the D-PADnavigateWithDPad
- True if events should be triggeredpublic void setDebug(boolean debug)
public XboxButton getActionButton()
GamePadUiInput
Actionable
instancesgetActionButton
in interface GamePadUiInput<XboxButton>
public void setActionButton(XboxButton actionButton)
GamePadUiInput
Actionable
instancessetActionButton
in interface GamePadUiInput<XboxButton>
public void dispose()
GamePadUiInput
UiContainer
dispose
in interface GamePadUiInput<XboxButton>
public java.lang.String getId()
GamePadUiInput
GamePadUiInput
getId
in interface GamePadUiInput<XboxButton>
String
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object