Class SDLJoystickComponent
Inherited Members
Namespace: OpenTK.Platform.Native.SDL
Assembly: OpenTK.Platform.dll
Syntax
public class SDLJoystickComponent : IJoystickComponent, IPalComponent
Properties
LeftDeadzone
The recommended deadzone value for the left analog stick.
Declaration
public float LeftDeadzone { get; }
Property Value
Type | Description |
---|---|
float |
Logger
The logger that this component uses to log diagnostic messages.
Declaration
public ILogger? Logger { get; set; }
Property Value
Type | Description |
---|---|
ILogger |
See Also
Name
Name of the abstraction layer component.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
string |
Provides
Specifies which PAL components this object provides.
Declaration
public PalComponents Provides { get; }
Property Value
Type | Description |
---|---|
PalComponents |
RightDeadzone
The recommended deadzone value for the right analog stick.
Declaration
public float RightDeadzone { get; }
Property Value
Type | Description |
---|---|
float |
TriggerThreshold
The recommended threshold for considering the left or right trigger pressed.
Declaration
public float TriggerThreshold { get; }
Property Value
Type | Description |
---|---|
float |
Methods
Close(JoystickHandle)
Closes a handle to a joystick.
Declaration
public 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
public 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
public 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
public Guid GetGuid(JoystickHandle handle)
Parameters
Type | Name | Description |
---|---|---|
JoystickHandle | handle |
Returns
Type | Description |
---|---|
Guid |
GetName(JoystickHandle)
Declaration
public string GetName(JoystickHandle handle)
Parameters
Type | Name | Description |
---|---|---|
JoystickHandle | handle |
Returns
Type | Description |
---|---|
string |
Initialize(ToolkitOptions)
Initialize the component.
Declaration
public void Initialize(ToolkitOptions options)
Parameters
Type | Name | Description |
---|---|---|
ToolkitOptions | options | The options to initialize the component with. |
See Also
IsConnected(int)
Checks wether a joystick with the specific index is present on the system or not.
Declaration
public 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
public 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
public 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
public bool TryGetBatteryInfo(JoystickHandle handle, out GamepadBatteryInfo batteryInfo)
Parameters
Type | Name | Description |
---|---|---|
JoystickHandle | handle | |
GamepadBatteryInfo | batteryInfo |
Returns
Type | Description |
---|---|
bool |
Uninitialize()
Uninitialize the component. Frees any native resources used by the component.
Declaration
public void Uninitialize()