Interface IDeviceInput
The interface for device input compatibility implementations.
Namespace: Phoenix.Input
Assembly: Phoenix.Abstractions.Input.dll
Syntax
public interface IDeviceInput
Properties
View SourceMaxNumConnectedGamepads
Gets the maximum number of connected gamepads that the device supports at once.
Declaration
int MaxNumConnectedGamepads { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
View SourceCreateGamepad()
Creates a virtual gamepad for the device.
Declaration
Guid CreateGamepad()
Returns
Type | Description |
---|---|
System.Guid | The id for the gamepad. |
DisconnectAllGamepads()
Disconnects all virtual gamepads from the device.
Declaration
Task DisconnectAllGamepads()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the result of the asynchronous operation. |
DisconnectGamepad(Guid)
Disconnects the specified gamepad from the device.
Declaration
void DisconnectGamepad(Guid gamepadId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | gamepadId | The gamepad to disconnect. |
GetButtonsState(Guid)
Gets the button state for the specified gamepad.
Declaration
GamepadButtons? GetButtonsState(Guid gamepadId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | gamepadId | The gamepad to query buttons from. |
Returns
Type | Description |
---|---|
System.Nullable<GamepadButtons> | The button states (null if the gamepad cannot be found) |
GetJoystickPosition(Guid, JoystickType)
Gets the joystick position for the specified gamepad.
Declaration
JoystickPosition GetJoystickPosition(Guid gamepadId, JoystickType joystick)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | gamepadId | The gamepad to get the joystick position from. |
JoystickType | joystick | The joystick type to query. |
Returns
Type | Description |
---|---|
JoystickPosition | The joystick position for the specified gamepad and joystick type. (null if not found) |
GetTriggerPosition(Guid, TriggerType)
Gets the trigger position for the specified gamepad.
Declaration
float? GetTriggerPosition(Guid gamepadId, TriggerType trigger)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | gamepadId | The gamepad to get the trigger position from. |
TriggerType | trigger | The trigger type to query. |
Returns
Type | Description |
---|---|
System.Nullable<System.Single> | The trigger position for the specified gamepad and trigger type (null if gamepad not found) |
HoldButtons(Guid, GamepadButtons)
Holds the specified buttons.
Declaration
void HoldButtons(Guid gamepadId, GamepadButtons buttons)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | gamepadId | The gamepad to send the button hold to. |
GamepadButtons | buttons | The buttons to hold. |
ReleaseButtons(Guid, GamepadButtons)
Releases the specified buttons.
Declaration
void ReleaseButtons(Guid gamepadId, GamepadButtons buttons)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | gamepadId | The gamepad to send the button release to. |
GamepadButtons | buttons | The buttons to release. |
SetJoystickPosition(Guid, JoystickType, JoystickPosition)
Sets the joystick position for the specified gamepad.
Declaration
void SetJoystickPosition(Guid gamepadId, JoystickType joystick, JoystickPosition position)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | gamepadId | The gamepad to set the joystick position for. |
JoystickType | joystick | The joystick type. |
JoystickPosition | position | The joystick position. |
SetTriggerPosition(Guid, TriggerType, Single)
Sets the trigger position for the specified gamepad.
Declaration
void SetTriggerPosition(Guid gamepadId, TriggerType trigger, float position)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | gamepadId | The gamepad to set the trigger position for. |
TriggerType | trigger | The trigger type. |
System.Single | position | The trigger position. |
TryPairWithUser(Guid, PhoenixUser, Boolean)
Tries to pair a gamepad with a user.
Declaration
Task<bool> TryPairWithUser(Guid gamepadId, PhoenixUser user, bool exclusive)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | gamepadId | The gamepad to pair the user to. |
PhoenixUser | user | The user to pair with the gamepad. |
System.Boolean | exclusive | Whether or not the gamepad should be paired exclusively with the user or not. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Boolean> | Whether or not the pairing was successful. |