public class Xbox360UiInput extends Xbox360ControllerAdapter implements ControllerUiInput<Xbox360Button>
Xbox360Controller
implementation of ControllerUiInput
Constructor and Description |
---|
Xbox360UiInput(UiContainer uiContainer) |
Modifier and Type | Method and Description |
---|---|
boolean |
buttonDown(Xbox360Controller controller,
Xbox360Button button)
Called when a button is pressed down
|
boolean |
buttonUp(Xbox360Controller controller,
Xbox360Button button)
Called when a button is released
|
void |
disable()
Disables this controller input for the
UiContainer |
void |
dispose()
Cleans up and de-registers this instance from the associated
UiContainer |
void |
enable()
Enables this controller input for the
UiContainer |
boolean |
equals(java.lang.Object obj) |
Xbox360Button |
getActionButton()
Returns the button used to trigger
Actionable instances |
java.lang.String |
getId()
Returns the unique id of this
ControllerUiInput |
int |
hashCode() |
boolean |
isEnabled()
Returns if the controller input is enabled for the
UiContainer |
boolean |
leftStickXMoved(Xbox360Controller controller,
float value)
Called when left stick moves along its X axis
|
boolean |
leftStickYMoved(Xbox360Controller controller,
float value)
Called when left stick moves along its Y axis
|
void |
setActionButton(Xbox360Button actionButton)
Sets the button used for triggering
Actionable instances |
void |
setDebug(boolean debug) |
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
|
disconnected, leftTriggerMoved, rightStickXMoved, rightStickYMoved, rightTriggerMoved
public Xbox360UiInput(UiContainer uiContainer)
public void update(float delta)
ControllerUiInput
update
in interface ControllerUiInput<Xbox360Button>
delta
- The time since the last frame (in seconds)public boolean leftStickXMoved(Xbox360Controller controller, float value)
Xbox360ControllerListener
leftStickXMoved
in interface Xbox360ControllerListener
leftStickXMoved
in class Xbox360ControllerAdapter
controller
- The controller 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
controller instance to correct this)public boolean leftStickYMoved(Xbox360Controller controller, float value)
Xbox360ControllerListener
leftStickYMoved
in interface Xbox360ControllerListener
leftStickYMoved
in class Xbox360ControllerAdapter
controller
- The controller 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
controller instance to correct this)public boolean buttonDown(Xbox360Controller controller, Xbox360Button button)
Xbox360ControllerListener
buttonDown
in interface Xbox360ControllerListener
buttonDown
in class Xbox360ControllerAdapter
controller
- The controller that this event came frombutton
- The button that was pressedpublic boolean buttonUp(Xbox360Controller controller, Xbox360Button button)
Xbox360ControllerListener
buttonUp
in interface Xbox360ControllerListener
buttonUp
in class Xbox360ControllerAdapter
controller
- The controller that this event came frombutton
- The button that was releasedpublic boolean isEnabled()
ControllerUiInput
UiContainer
isEnabled
in interface ControllerUiInput<Xbox360Button>
public void enable()
ControllerUiInput
UiContainer
enable
in interface ControllerUiInput<Xbox360Button>
public void disable()
ControllerUiInput
UiContainer
disable
in interface ControllerUiInput<Xbox360Button>
public void setStickRepeatTimer(float stickRepeatTimer)
stickRepeatTimer
- Default value is 0.25 secondspublic void setStickThreshold(float stickThreshold)
stickThreshold
- Default value is 0.25public void setDebug(boolean debug)
public Xbox360Button getActionButton()
ControllerUiInput
Actionable
instancesgetActionButton
in interface ControllerUiInput<Xbox360Button>
public void setActionButton(Xbox360Button actionButton)
ControllerUiInput
Actionable
instancessetActionButton
in interface ControllerUiInput<Xbox360Button>
public void dispose()
ControllerUiInput
UiContainer
dispose
in interface ControllerUiInput<Xbox360Button>
public java.lang.String getId()
ControllerUiInput
ControllerUiInput
getId
in interface ControllerUiInput<Xbox360Button>
String
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object