Show / Hide Table of Contents

Class JoystickComponent

Win32 implementation of IJoystickComponent.

Inheritance
object
JoystickComponent
Implements
IJoystickComponent
IPalComponent
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: OpenTK.Platform.Native.Windows
Assembly: OpenTK.Platform.dll
Syntax
public class JoystickComponent : 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
ILogger
Logger

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

GetNumberOfAxes(JoystickHandle)

Declaration
public int GetNumberOfAxes(JoystickHandle handle)
Parameters
Type Name Description
JoystickHandle handle
Returns
Type Description
int

GetNumberOfButtons(JoystickHandle)

Declaration
public int GetNumberOfButtons(JoystickHandle handle)
Parameters
Type Name Description
JoystickHandle handle
Returns
Type Description
int

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
ToolkitOptions
Init(ToolkitOptions)

IsConnected(int)

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.

Open(int)

Opens a handle to a specific joystick.

Declaration
public JoystickHandle Open(int deviceIndex)
Parameters
Type Name Description
int deviceIndex
Returns
Type Description
JoystickHandle

The opened joystick handle.

SetVibration(JoystickHandle, float, float)

Declaration
public bool SetVibration(JoystickHandle handle, float lowFrequenzyIntensity, float highFrequenzyIntensity)
Parameters
Type Name Description
JoystickHandle handle
float lowFrequenzyIntensity
float highFrequenzyIntensity
Returns
Type Description
bool

SupportsForceFeedback(JoystickHandle)

Declaration
public bool SupportsForceFeedback(JoystickHandle handle)
Parameters
Type Name Description
JoystickHandle handle
Returns
Type Description
bool

SupportsVibration(JoystickHandle)

Declaration
public bool SupportsVibration(JoystickHandle handle)
Parameters
Type Name Description
JoystickHandle handle
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()
See Also
Uninit()

Implements

IJoystickComponent
IPalComponent
In this article
  • Properties
    • LeftDeadzone
    • Logger
    • Name
    • Provides
    • RightDeadzone
    • TriggerThreshold
  • Methods
    • Close(JoystickHandle)
    • GetAxis(JoystickHandle, JoystickAxis)
    • GetButton(JoystickHandle, JoystickButton)
    • GetGuid(JoystickHandle)
    • GetName(JoystickHandle)
    • GetNumberOfAxes(JoystickHandle)
    • GetNumberOfButtons(JoystickHandle)
    • Initialize(ToolkitOptions)
    • IsConnected(int)
    • Open(int)
    • SetVibration(JoystickHandle, float, float)
    • SupportsForceFeedback(JoystickHandle)
    • SupportsVibration(JoystickHandle)
    • TryGetBatteryInfo(JoystickHandle, out GamepadBatteryInfo)
    • Uninitialize()
  • Implements
Back to top Generated by DocFX