Class JoystickComponent
Inheritance
JoystickComponent
Assembly: OpenTK.Platform.dll
public class JoystickComponent : IJoystickComponent, IPalComponent
Properties
The recommended deadzone value for the left analog stick.
Declaration
public float LeftDeadzone { get; }
Property Value
The logger that this component uses to log diagnostic messages.
Declaration
public ILogger? Logger { get; set; }
Property Value
Name of the abstraction layer component.
Declaration
public string Name { get; }
Property Value
Specifies which PAL components this object provides.
Declaration
public PalComponents Provides { get; }
Property Value
The recommended deadzone value for the right analog stick.
Declaration
public float RightDeadzone { get; }
Property Value
The recommended threshold for considering the left or right trigger pressed.
Declaration
public float TriggerThreshold { get; }
Property Value
Methods
Closes a handle to a joystick.
Declaration
public void Close(JoystickHandle handle)
Parameters
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
Returns
Type |
Description |
float |
The joystick axis value.
|
Get the pressed state of a specific joystick button.
Declaration
public bool GetButton(JoystickHandle handle, JoystickButton button)
Parameters
Returns
Type |
Description |
bool |
True if the specified button is pressed or false if the button is released.
|
Declaration
public Guid GetGuid(JoystickHandle handle)
Parameters
Returns
Declaration
public string GetName(JoystickHandle handle)
Parameters
Returns
Declaration
public int GetNumberOfAxes(JoystickHandle handle)
Parameters
Returns
Declaration
public int GetNumberOfButtons(JoystickHandle handle)
Parameters
Returns
Initialize the component.
Declaration
public void Initialize(ToolkitOptions options)
Parameters
Type |
Name |
Description |
ToolkitOptions |
options |
The options to initialize the component with.
|
Checks wether a joystick with the specific index is present on the system or not.
Declaration
public bool IsConnected(int deviceIndex)
Parameters
Type |
Name |
Description |
int |
deviceIndex |
|
Returns
Type |
Description |
bool |
If a joystick with the specified index is connected.
|
Opens a handle to a specific joystick.
Declaration
public JoystickHandle Open(int deviceIndex)
Parameters
Type |
Name |
Description |
int |
deviceIndex |
|
Returns
Declaration
public bool SetVibration(JoystickHandle handle, float lowFrequenzyIntensity, float highFrequenzyIntensity)
Parameters
Returns
Declaration
public bool SupportsForceFeedback(JoystickHandle handle)
Parameters
Returns
Declaration
public bool SupportsVibration(JoystickHandle handle)
Parameters
Returns
Declaration
public bool TryGetBatteryInfo(JoystickHandle handle, out GamepadBatteryInfo batteryInfo)
Parameters
Returns
Uninitialize the component. Frees any native resources used by the component.
Declaration
public void Uninitialize()
Implements