A Player Controller class for quick and easy controller setup

Constructor

new (?options:ControllerOptions)

Creates a new player controller with given options

 *  @param options	ControllerOptions - {
 *  	binding:Map<ControllerButton, FlxKey>	controller bindings,
 *  	density:ControllerDensity				NES/GENESIS/SNES,
 *  	gamepad_options:GamepadOptions - {
 *  		id:Int								Gamepad ID,
 *  		connect_timer:Float					how often to try to connect,
 *  		binding:Map<ControllerButton, FlxGamepadInputID>	gamepad bindings,
 *  		on_connect:Void -> Void				on connect callback
 *  		on_disconnect:Void -> Void			on disconnect callback,
 *  	}
 *  }

Methods

add ():Void

Add this controller (and gamepad controller) to state, use instead of [FlxState].add(player_controller)

bind (button:ControllerButton, key:FlxKey):Void

Bind a button to a keyboard key

 *  @param button	button
 *  @param key		key

Inherited Variables

Defined by Controller

@:value(false)protected:Bool = false

@:value(new Map())state:Map<ControllerButton, Bool> = new Map()

The current state of the controller

Inherited Methods

Defined by Controller

inlineget_history ():Array<Map<ControllerButton, Bool>>

Returns a history of states for the controller

 *  @return	Array<Map<ControllerButton, Bool>>

inlinejust_pressed (button:ControllerButton):Bool

Gets the just pressed state of a button

 *  @param button	button query
 *  @return			Bool

inlinejust_released (button:ControllerButton):Bool

Gets the just released state of a button

 *  @param button	button query
 *  @return			Bool

inlinepressed (button:ControllerButton):Bool

Gets the pressed state of a button

 *  @param button	button query
 *  @return			Bool

private@:dox(show)set (dt:Float):Void

inlineset_button (button:ControllerButton, pressed:Bool):Void

Set button state

 *  @param button	button to set
 *  @param pressed	whether it's pressed or not

inlineset_max_history (length:Int):Void

Set the maximum number of history states

 *  @param length	length of max history states