InputMapController
An InputProcessor that handles Key, GameButton, and GameAxis inputs and converts them into a single input signal to be used similarly as Input except with a custom InputSignal type.
Bindings can be added to addBinding for multiple input sources. These bindings then can be added as an axis or a vector. The input signal can then be checked like Input normally would be using input methods this class provides. Additionally, the strength, distances, and angles of each input can be calculated.
Author
Colt Daily
See also
Parameters
the current input of the context
Constructors
Types
Functions
Create an axis from two InputSignal bindings. In order to have a proper axis, the two signals must have been bound in addBinding. The axis is calculated as follows: positive - negative
. Note: this will replace any existing axis if it exists.
Create a binding of multiple keys and buttons into a single InputSignal.
Create a vector from four InputSignal bindings. Think of it as two axes in as a single result. In order to have a proper vector, the four signals must have been bound in addBinding. The vector is calculated as follows: positiveX - negativeX
and positiveY - negativeY
. Note: this will replace any existing vector if it exists.
Calculates the angle of a vector InputSignal. Requires a vector to have been added with the specified vector.
Calculates the angle between both InputSignal axes. Requires the axes to have been added with the specified axis and yAxis.
Returns the strength of this InputSignal as an axis. This will take the positive axis and subtract it by the negative axis. This is the same as doing strength(positive) - strength(negative)
. Requires an axis to have been added with the specified type.
Takes the absolute value of the strength of this InputSignal
Calculates the distance between each axes InputSignal and returns the highest distance.
Calculates the distance between each axes in this vector InputSignal and returns the highest distance.
Checks to see if the InputSignal is currently down for all inputs. This does not trigger for GameAxis.
Invoked when a GameButton is initially pressed on a GamepadInfo.
Invoked when a GameButton is released on a GamepadInfo.
Invoked when a GameStick is moved on a GamepadInfo.
Invoked when a GameButton that is considered a trigger is changed / moved.
Invoked when the mouse is moved.
Checks to see if the InputSignal is just pressed for all inputs. This does not trigger for GameAxis.
Checks to see if the InputSignal is just released for all inputs. This does not trigger for GameAxis.
Returns the strength of this InputSignal. GameButton and Key will return as either -1
, 0
, or 1
. A GameAxis will return anything between -1
to 1
.
Returns the strength of this InputSignal as a vector. This will take the positive X and Y axes and subtract it by the negative X and Y axes. Requires a vector to have been added with the specified type.