Class DpadControl
A control made up of four discrete, directional buttons. Forms a vector but can also be addressed as individual buttons.
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: UnityEngine.Experimental.Input.Controls
Syntax
public class DpadControl : InputControl<Vector2>
Remarks
Is stored as four bits by default.
The vector that is aggregated from the button states is normalized. I.e.
even if pressing diagonally, the vector will have a length of 1 (instead
of reading something like (1,1)
for example).
Constructors
DpadControl()
Declaration
public DpadControl()
Properties
down
The button representing the vertical downwards state of the D-Pad.
Declaration
public ButtonControl down { get; }
Property Value
Type | Description |
---|---|
ButtonControl |
left
The button representing the horizontal left state of the D-Pad.
Declaration
public ButtonControl left { get; }
Property Value
Type | Description |
---|---|
ButtonControl |
right
The button representing the horizontal right state of the D-Pad.
Declaration
public ButtonControl right { get; }
Property Value
Type | Description |
---|---|
ButtonControl |
up
The button representing the vertical upwards state of the D-Pad.
Declaration
public ButtonControl up { get; }
Property Value
Type | Description |
---|---|
ButtonControl |
Methods
FinishSetup(InputDeviceBuilder)
Declaration
protected override void FinishSetup(InputDeviceBuilder builder)
Parameters
Type | Name | Description |
---|---|---|
InputDeviceBuilder | builder |
Overrides
MakeDpadVector(Boolean, Boolean, Boolean, Boolean, Boolean)
Create a direction vector from the given four button states.
Declaration
public static Vector2 MakeDpadVector(bool up, bool down, bool left, bool right, bool normalize = true)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | up | |
System.Boolean | down | |
System.Boolean | left | |
System.Boolean | right | |
System.Boolean | normalize |
Returns
Type | Description |
---|---|
Vector2 | A normalized 2D direction vector. |
ReadUnprocessedValueFromState(Void*)
Declaration
public override Vector2 ReadUnprocessedValueFromState(void *statePtr)
Parameters
Type | Name | Description |
---|---|---|
System.Void* | statePtr |
Returns
Type | Description |
---|---|
Vector2 |
Overrides
UnityEngine.Experimental.Input.InputControl<Vector2>.ReadUnprocessedValueFromState(System.Void*)
WriteValueIntoState(Vector2, Void*)
Declaration
public override void WriteValueIntoState(Vector2 value, void *statePtr)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value | |
System.Void* | statePtr |
Overrides
UnityEngine.Experimental.Input.InputControl<Vector2>.WriteValueIntoState(Vector2, System.Void*)