Constructor

Variables

read onlyanalog:FlxGamepadAnalogList

Helper class to get the justMoved, justReleased, and float values of analog input.

attachment:FlxGamepadAttachment

For gamepads that can have things plugged into them (the Wii Remote, basically). Making the user set this helps Flixel properly interpret inputs properly. EX: if you plug a nunchuk into the Wii Remote, you will get different values for certain buttons than with the Wii Remote alone. (This is probably why Wii games ask the player what control scheme they are using.)

In the future, this could also be used for any attachment that exposes new API features to the controller, e.g. a microphone or headset

@:value(true)read onlyconnected:Bool = true

deadZone:Float

Gamepad deadzone. The lower, the more sensitive the gamepad. Should be between 0.0 and 1.0. Defaults to 0.15.

@:value(INDEPENDENT_AXES)deadZoneMode:FlxGamepadDeadZoneMode = INDEPENDENT_AXES

Which dead zone mode to use for analog sticks.

read onlydetectedModel:FlxGamepadModel

The gamepad model this gamepad has been identified as.

read onlyid:Int

read onlyjustPressed:FlxGamepadButtonList

Helper class to check if a button was just pressed.

read onlyjustReleased:FlxGamepadButtonList

Helper class to check if a button was just released.

mapping:FlxGamepadMapping

The mapping that is used to map the raw hardware IDs to the values in FlxGamepadInputID. Determined by the current model. It's also possible to create a custom mapping and assign it here.

model:FlxGamepadModel

The gamepad model used for the mapping of the IDs. Defaults to detectedModel, but can be changed manually.

read onlymotion:FlxGamepadMotionValueList

Helper class to get the float values of motion-sensing input, if it is supported

read onlyname:String

The device name. Used to determine the model.

read onlypointer:FlxGamepadPointerValueList

Helper class to get the float values of mouse-like pointer input, if it is supported. (contains continously updated X and Y coordinates, each between 0.0 and 1.0)

read onlypressed:FlxGamepadButtonList

Helper class to check if a button is pressed.

read onlyreleased:FlxGamepadButtonList

Helper class to check if a button is released

Methods

@:value({ state : PRESSED })anyButton(state:FlxInputState = PRESSED):Bool

Whether any buttons have the specified input state.

anyInput():Bool

Check to see if any buttons are pressed right or Axis, Ball and Hat moved now.

inlineanyJustPressed(IDArray:Array<FlxGamepadInputID>):Bool

Check if at least one button from an array of universal button IDs was just pressed.

Parameters:

IDArray

An array of "universal" gamepad input IDs

Returns:

Whether at least one of the buttons was just pressed

inlineanyJustPressedRaw(RawIDArray:Array<Int>):Bool

Check if at least one button from an array of raw button IDs was just pressed.

Parameters:

RawIDArray

An array of raw button IDs

Returns:

Whether at least one of the buttons was just pressed

inlineanyJustReleased(IDArray:Array<FlxGamepadInputID>):Bool

Check if at least one button from an array of gamepad input IDs was just released.

Parameters:

IDArray

An array of "universal" gamepad input IDs

Returns:

Whether at least one of the buttons was just released

inlineanyJustReleasedRaw(RawIDArray:Array<Int>):Bool

Check if at least one button from an array of raw button IDs was just released.

Parameters:

RawArray

An array of raw button IDs

Returns:

Whether at least one of the buttons was just released

inlineanyPressed(IDArray:Array<FlxGamepadInputID>):Bool

Check if at least one button from an array of button IDs is pressed.

Parameters:

IDArray

An array of "universal" gamepad input IDs

Returns:

Whether at least one of the buttons is pressed

inlineanyPressedRaw(RawIDArray:Array<Int>):Bool

Check if at least one button from an array of raw button IDs is pressed.

Parameters:

RawIDArray

An array of raw button IDs

Returns:

Whether at least one of the buttons is pressed

inlinecheckStatus(ID:FlxGamepadInputID, Status:FlxInputState):Bool

Check the status of a "universal" button ID, auto-mapped to this gamepad (something like FlxGamepadInputID.A).

Parameters:

ID

"universal" gamepad input ID

Status

The key state to check for

Returns:

Whether the provided button has the specified status

inlinecheckStatusRaw(RawID:Int, Status:FlxInputState):Bool

Check the status of a raw button ID (like XInputID.A).

Parameters:

RawID

Index into buttons array.

Status

The key state to check for

Returns:

Whether the provided button has the specified status

inlinefirstJustPressedID():FlxGamepadInputID

Get the first found "universal" ButtonID of the button which has been just pressed. Returns NONE if no button was just pressed.

firstJustPressedRawID():Int

Get the first found raw ID of the button which has been just pressed. Returns -1 if no button was just pressed.

inlinefirstJustReleasedID():FlxGamepadInputID

Get the first found "universal" ButtonID of the button which has been just released. Returns NONE if no button was just released.

firstJustReleasedRawID():Int

Get the first found raw ID of the button which has been just released. Returns -1 if no button was just released.

inlinefirstPressedID():FlxGamepadInputID

Get the first found "universal" ID of the button which is currently pressed. Returns NONE if no button is pressed.

firstPressedRawID():Int

Get the first found raw ID of the button which is currently pressed. Returns -1 if no button is pressed.

getAnalogAxes(AxesButtonID:FlxGamepadInputID):FlxPoint

Convenience method that wraps getXAxis() and getYAxis() into a FlxPoint.

Parameters:

AxesButtonID

an analog stick like FlxGamepadButtonID.LEFT_STICK

Available since

4.3.0

.

getAxis(AxisButtonID:FlxGamepadInputID):Float

Gets the value of the specified axis using the "universal" ButtonID - use this only for things like FlxGamepadButtonID.LEFT_TRIGGER, use getXAxis() / getYAxis() for analog sticks!

inlinegetAxisRaw(RawAxisID:Int):Float

Gets the value of the specified axis using the raw ID - use this only for things like XInputID.LEFT_TRIGGER, use getXAxis() / getYAxis() for analog sticks!

inlinegetInputLabel(id:FlxGamepadInputID):Null<String>

Available since

4.8.0

.

inlinegetXAxis(AxesButtonID:FlxGamepadInputID):Float

Given a ButtonID for an analog stick, gets the value of its x axis

Parameters:

AxesButtonID

an analog stick like FlxGamepadButtonID.LEFT_STICK

inlinegetXAxisRaw(Stick:FlxGamepadAnalogStick):Float

Given both raw IDs for the axes of an analog stick, gets the value of its x axis

inlinegetYAxis(AxesButtonID:FlxGamepadInputID):Float

Given a ButtonID for an analog stick, gets the value of its y axis

Parameters:

AxesButtonID

an analog stick like FlxGamepadButtonID.LEFT_STICK

getYAxisRaw(Stick:FlxGamepadAnalogStick):Float

Given both raw ID's for the axes of an analog stick, gets the value of its Y axis (should be used in flash to correct the inverted y axis)

update():Void

Updates the key states (for tracking just pressed, just released, etc).