Struct JoystickState
Describes the current state of a JoystickDevice.
Implements
Inherited Members
Namespace: OpenTK.Input
Assembly: OpenTK.dll
Syntax
public struct JoystickState : IEquatable<JoystickState>
Properties
IsAnyButtonDown
Gets a value indicating whether any button is down.
Declaration
public readonly bool IsAnyButtonDown { get; }
Property Value
Type | Description |
---|---|
Boolean |
|
IsConnected
Gets a value indicating whether this instance is connected.
Declaration
public bool IsConnected { get; }
Property Value
Type | Description |
---|---|
Boolean |
|
Methods
Equals(JoystickState)
Determines whether the specified JoystickState is equal to the current JoystickState.
Declaration
public bool Equals(JoystickState other)
Parameters
Type | Name | Description |
---|---|---|
JoystickState | other | The JoystickState to compare with the current JoystickState. |
Returns
Type | Description |
---|---|
Boolean |
|
Equals(Object)
Determines whether the specified Object is equal to the current JoystickState.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The Object to compare with the current JoystickState. |
Returns
Type | Description |
---|---|
Boolean |
|
Overrides
GetAxis(Int32)
Gets a value between -1.0 and 1.0 representing the current offset of the specified axis.
Declaration
public float GetAxis(int axis)
Parameters
Type | Name | Description |
---|---|---|
Int32 | axis | The axis to query. |
Returns
Type | Description |
---|---|
Single | A value between -1.0 and 1.0 representing offset of the specified axis. If the specified axis does not exist, then the return value is 0.0. Use GetCapabilities(Int32) to query the number of available axes. |
GetButton(Int32)
Gets the current ButtonState of the specified button.
Declaration
public ButtonState GetButton(int button)
Parameters
Type | Name | Description |
---|---|---|
Int32 | button | The button to query. |
Returns
Type | Description |
---|---|
ButtonState | Pressed if the specified button is pressed; otherwise, Released. |
GetHashCode()
Serves as a hash function for a JoystickState object.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | A hash code for this instance that is suitable for use in hashing algorithms and data structures such as a hash table. |
Overrides
GetHat(JoystickHat)
Gets the hat.
Declaration
public JoystickHatState GetHat(JoystickHat hat)
Parameters
Type | Name | Description |
---|---|---|
JoystickHat | hat | Hat. |
Returns
Type | Description |
---|---|
JoystickHatState | The hat. |
IsButtonDown(Int32)
Gets a value indicating whether the specified button is currently pressed.
Declaration
public bool IsButtonDown(int button)
Parameters
Type | Name | Description |
---|---|---|
Int32 | button | The button to query. |
Returns
Type | Description |
---|---|
Boolean | true if the specified button is pressed; otherwise, false. |
IsButtonUp(Int32)
Gets a value indicating whether the specified button is currently released.
Declaration
public bool IsButtonUp(int button)
Parameters
Type | Name | Description |
---|---|---|
Int32 | button | The button to query. |
Returns
Type | Description |
---|---|
Boolean | true if the specified button is released; otherwise, false. |
ToString()
Returns a String that represents the current JoystickState.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | A String that represents the current JoystickState. |