Interface IJoystickComponent
Interface for interacting with joysticks.
Inherited Members
Namespace: OpenTK.Platform
Assembly: OpenTK.Platform.dll
Syntax
public interface IJoystickComponent : IPalComponent
Properties
LeftDeadzone
The recommended deadzone value for the left analog stick.
Declaration
float LeftDeadzone { get; }
Property Value
Type | Description |
---|---|
float |
RightDeadzone
The recommended deadzone value for the right analog stick.
Declaration
float RightDeadzone { get; }
Property Value
Type | Description |
---|---|
float |
TriggerThreshold
The recommended threshold for considering the left or right trigger pressed.
Declaration
float TriggerThreshold { get; }
Property Value
Type | Description |
---|---|
float |
Methods
Close(JoystickHandle)
Closes a handle to a joystick.
Declaration
void Close(JoystickHandle handle)
Parameters
Type | Name | Description |
---|---|---|
JoystickHandle | handle | The joystick handle. |
GetAxis(JoystickHandle, JoystickAxis)
Gets the value of a specific joystick axis. This value is in the range [-1, 1] for analog sticks, and [0, 1] for triggers.
Declaration
float GetAxis(JoystickHandle handle, JoystickAxis axis)
Parameters
Type | Name | Description |
---|---|---|
JoystickHandle | handle | A handle to a joystick. |
JoystickAxis | axis | The joystick axis to get. |
Returns
Type | Description |
---|---|
float | The joystick axis value. |
GetButton(JoystickHandle, JoystickButton)
Get the pressed state of a specific joystick button.
Declaration
bool GetButton(JoystickHandle handle, JoystickButton button)
Parameters
Type | Name | Description |
---|---|---|
JoystickHandle | handle | A handle to a joystick. |
JoystickButton | button | The joystick button to get. |
Returns
Type | Description |
---|---|
bool | True if the specified button is pressed or false if the button is released. |
GetGuid(JoystickHandle)
Declaration
Guid GetGuid(JoystickHandle handle)
Parameters
Type | Name | Description |
---|---|---|
JoystickHandle | handle |
Returns
Type | Description |
---|---|
Guid |
GetName(JoystickHandle)
Declaration
string GetName(JoystickHandle handle)
Parameters
Type | Name | Description |
---|---|---|
JoystickHandle | handle |
Returns
Type | Description |
---|---|
string |
IsConnected(int)
Checks wether a joystick with the specific index is present on the system or not.
Declaration
bool IsConnected(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the joystick. |
Returns
Type | Description |
---|---|
bool | If a joystick with the specified index is connected. |
Open(int)
Opens a handle to a specific joystick.
Declaration
JoystickHandle Open(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The player index of the joystick to open. |
Returns
Type | Description |
---|---|
JoystickHandle | The opened joystick handle. |
SetVibration(JoystickHandle, float, float)
Declaration
bool SetVibration(JoystickHandle handle, float lowFreqIntensity, float highFreqIntensity)
Parameters
Type | Name | Description |
---|---|---|
JoystickHandle | handle | |
float | lowFreqIntensity | |
float | highFreqIntensity |
Returns
Type | Description |
---|---|
bool |
TryGetBatteryInfo(JoystickHandle, out GamepadBatteryInfo)
Declaration
bool TryGetBatteryInfo(JoystickHandle handle, out GamepadBatteryInfo batteryInfo)
Parameters
Type | Name | Description |
---|---|---|
JoystickHandle | handle | |
GamepadBatteryInfo | batteryInfo |
Returns
Type | Description |
---|---|
bool |