Show / Hide Table of Contents

Class GamePad

Provides access to GamePad devices. A GamePad device offers a well-defined layout with one direction-pad, two thumbsticks, two triggers, four main buttons (A, B, X, Y) and up to seven auxilliary buttons. Use GetCapabilities to retrieve the exact capabilities of a given device. Use GetState to retrieve the current state of a given device.

Inheritance
Object
GamePad
Inherited Members
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Namespace: OpenTK.Input
Assembly: OpenTK.dll
Syntax
public sealed class GamePad

Methods

GetCapabilities(Int32)

Retrieves a GamePadCapabilities structure describing the capabilities of a gamepad device.

Declaration
public static GamePadCapabilities GetCapabilities(int index)
Parameters
Type Name Description
Int32 index

The zero-based index of a gamepad device.

Returns
Type Description
GamePadCapabilities

A GamePadCapabilities structure describing the capabilities of the gamepad device.

GetName(Int32)

Gets the name of this GamePad

Declaration
public static string GetName(int index)
Parameters
Type Name Description
Int32 index

A zero-based device index for the GamePad device to affect

Returns
Type Description
String

Returns the name of the gamepad if the gamepad is connected. Otherwise returns an empty string.

GetState(Int32)

Retrieves the GamePadState for the specified gamepad device.

Declaration
public static GamePadState GetState(int index)
Parameters
Type Name Description
Int32 index

The zero-based index of a gamepad device.

Returns
Type Description
GamePadState

A GamePadState structure describing the state of the gamepad device.

SetVibration(Int32, Single, Single)

Sets the vibration intensity for the left and right motors of this GamePad

Declaration
public static bool SetVibration(int index, float left, float right)
Parameters
Type Name Description
Int32 index

A zero-based device index for the GamePad device to affect

Single left

The vibration intensity for the left motor, between 0.0 and 1.0.

Single right

The vibration intensity for the right motor, between 0.0 and 1.0.

Returns
Type Description
Boolean

true, if vibration was set, false otherwise. This method can return false if the GamePad hardware does not support vibration or if it cannot respond to the command for any reason. Do not loop until this becomes true, but rather ignore a return value of false.

In This Article
Back to top Generated by DocFX