Show / Hide Table of Contents

Class JoystickState

Encapsulates the state of a joystick device.

Inheritance
object
JoystickState
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
Namespace: OpenTK.Windowing.GraphicsLibraryFramework
Assembly: OpenTK.Windowing.GraphicsLibraryFramework.dll
Syntax
public class JoystickState

Properties

AxisCount

Gets the number of axes on the joystick this state describes.

Declaration
public int AxisCount { get; }
Property Value
Type Description
int

ButtonCount

Gets the number of buttons on the joystick this state describes.

Declaration
public int ButtonCount { get; }
Property Value
Type Description
int

HatCount

Gets the number of hats on the joystick this state describes.

Declaration
public int HatCount { get; }
Property Value
Type Description
int

Id

Gets the identity of the joystick this state describes.

Declaration
public int Id { get; }
Property Value
Type Description
int

Name

Gets the name of the joystick this state describes.

Declaration
public string Name { get; }
Property Value
Type Description
string

Methods

GetAxis(int)

Gets a float between -1 and 1 describing the position of an axis.

Declaration
public float GetAxis(int index)
Parameters
Type Name Description
int index

The index of the Axis to check.

Returns
Type Description
float

A float between -1 and 1 describing the position of the axis.

GetAxisPrevious(int)

Gets a float between -1 and 1 describing the previous position of an axis.

Declaration
public float GetAxisPrevious(int index)
Parameters
Type Name Description
int index

The index of the Axis to check.

Returns
Type Description
float

A float between -1 and 1 describing the position of the axis.

GetHat(int)

Gets a Hat describing the state of a hat.

Declaration
public Hat GetHat(int index)
Parameters
Type Name Description
int index

The index of the hat to check.

Returns
Type Description
Hat

A Hat describing the hat state.

GetHatPrevious(int)

Gets a Hat describing the previous state of a hat.

Declaration
public Hat GetHatPrevious(int index)
Parameters
Type Name Description
int index

The index of the hat to check.

Returns
Type Description
Hat

A Hat describing the hat state.

GetSnapshot()

Gets an immutable snapshot of this JoystickState. This can be used to save the current joystick state for comparison later on.

Declaration
public JoystickState GetSnapshot()
Returns
Type Description
JoystickState

Returns an immutable snapshot of this JoystickState.

IsButtonDown(int)

Gets a bool describing the state of a button in the current frame.

Declaration
public bool IsButtonDown(int index)
Parameters
Type Name Description
int index

The index of the button to check.

Returns
Type Description
bool

true if the button is down; false otherwise.

IsButtonPressed(int)

Gets a bool describing whether the specified button is down in the current frame but was up in the previous frame.

Declaration
public bool IsButtonPressed(int index)
Parameters
Type Name Description
int index

The index of the button.

Returns
Type Description
bool

True if the button is down in this frame, but not the last frame.

Remarks

"Frame" refers to invocations of ( more precisely) here.

IsButtonReleased(int)

Gets a bool describing whether the specified button is up in the current frame but was down in the previous frame.

Declaration
public bool IsButtonReleased(int index)
Parameters
Type Name Description
int index

The index of the button.

Returns
Type Description
bool

True if the button is up in this frame, but down the last frame.

Remarks

"Frame" refers to invocations of ( more precisely) here.

ToString()

Declaration
public override string ToString()
Returns
Type Description
string
Overrides
object.ToString()

WasButtonDown(int)

Gets a bool describing whether the button was down in the previous frame.

Declaration
public bool WasButtonDown(int index)
Parameters
Type Name Description
int index

The index of the button.

Returns
Type Description
bool

Returns true if the button was down, or false if the button was not down.

In This Article
Back to top Generated by DocFX