Module

GameInputDevice


Description

Manages a specific game input device. Not supported on Linux.

Properties

Name

Type

Read-Only

Shared

Connected

Boolean

ElementCount

Integer

Index

Integer

Name

String

Methods

Name

Parameters

Returns

Shared

Element

Index As Integer

GameInputElement

Property descriptions


GameInputDevice.Connected

Connected As Boolean

If True, the device is currently connected. False indicates that the device is not connected.

This property is read-only.

This example checks to see that the selected device in a ListBox is connected.

Var i, maxi As Integer
Var device As GameInputDevice

device = mManager.Device(Listbox1.SelectedRowIndex)

If device.Connected Then
  MessageBox("connected")
Else
  MessageBox("not connected")
End If

GameInputDevice.ElementCount

ElementCount As Integer

The number of elements the device has.

This property is read-only.

This example gets the number of GameInputDevices and then populates a PopupMenu with the names of those devices.

Var i, maxi As Integer
Var device As GameInputDevice

ElementPop.RemoveAllRows
device = mManager.Device(Me.SelectedRowIndex) ' selected device in Device popup
If device <> Nil Then
  maxi = device.ElementCount
  For i = 0 To maxi - 1
    ElementPop.AddRow(device.Element(i).Name)
  Next
End If

mElement = Nil

GameInputDevice.Index

Index As Integer

The index of this device in the GameInputManager.

This property is read-only.

This example reports the number of the selected GameInputManager in a ListBox.

Var i, maxi As Integer
Var device As GameInputDevice

device = mManager.Device(ListBox1.SelectedIndex)

If device.Connected Then
  MessageBox(device.Index.ToString + " is connected.")
Else
  MessageBox("not connected.")
End If

GameInputDevice.Name

Name As String

The human-readable unique name of this device.

This property is read-only.

This example loads the names of all the devices into a PopupMenu.

Var i, maxi As Integer
Var device As GameInputDevice

ElementPop.RemoveAllRows
device = mManager.Device(Me.SelectedRowIndex) ' selected device in Device popup
If device <> Nil Then
  maxi = device.ElementCount
  For i = 0 To maxi - 1
    ElementPop.AddRow(device.Element(i).Name)
  Next
End If

mElement = Nil

Method descriptions


GameInputDevice.Element

Element(Index As Integer) As GameInputElement

Returns the GameInputElement specified by Index.

Var i, maxi As Integer
Var device As GameInputDevice

ElementPop.RemoveAllRows
device = mManager.Device(Me.SelectedRowIndex) ' selected device in Device popup
If device <> Nil Then
  maxi = device.ElementCount
  For i = 0 To maxi - 1
    ElementPop.AddRow(device.Element(i).Name)
  Next
End If

mElement = Nil

Notes

A GameInputDevice is a specialized input device used for gaming, such as a joystick. You can also read the keyboard and the standard mouse as GameInputDevices. The Device and DeviceCount properties of the GameInputManager class enable you to read the user's GameInputDevices and the Name property of the GameInputDevice class gives you the name of each device.

Each of the device's controls is a GameInputElement.

Compatibility

All project types on all supported operating systems.

See also

GameInputElement, GameInputManager classes.