Drag[en]gine Game Engine  1.0
deInputDevice Class Reference

Input device installed on the host system. More...

#include <deInputDevice.h>

Public Member Functions

Constructors and Destructors
 deInputDevice ()
 Create input device. More...
 
 deInputDevice (const deInputDevice &device)
 Create copy of input device. More...
 
 ~deInputDevice ()
 Clean up input device. More...
 
Management
const decStringGetID () const
 Device identifier. More...
 
void SetID (const char *id)
 Set identifier. More...
 
const decStringGetName () const
 Display name. More...
 
void SetName (const char *name)
 Set Display name. More...
 
deImageGetDisplayImage () const
 Image to represent the device in 2D user interfaces or null if not set. More...
 
void SetDisplayImage (deImage *image)
 Set image to represent the device in 2D user interfaces or null if not set. More...
 
deModelGetDisplayModel () const
 Model to represent the device in 3D user interfaces or null if not set. More...
 
void SetDisplayModel (deModel *model)
 Set model to represent the device in 3D user interfaces or null if not set. More...
 
deSkinGetDisplaySkin () const
 Skin for display model or null if not set. More...
 
void SetDisplaySkin (deSkin *skin)
 Set skin for display model or null if not set. More...
 
Buttons
int GetButtonCount () const
 Number of buttons. More...
 
void SetButtonCount (int count)
 Set number of buttons. More...
 
deInputDeviceButtonGetButtonAt (int index) const
 Button at index. More...
 
int IndexOfButtonWithID (const char *id) const
 Index of button with identifier or -1 if not found. More...
 
Axes
int GetAxisCount () const
 Number of axes. More...
 
void SetAxisCount (int count)
 Set number of axes. More...
 
deInputDeviceAxisGetAxisAt (int index) const
 Axis at index. More...
 
int IndexOfAxisWithID (const char *id) const
 Index of axis with identifier or -1 if not found. More...
 
Operators
deInputDeviceoperator= (const deInputDevice &device)
 Copy input device. More...
 

Detailed Description

Input device installed on the host system.

Input devices provide digital or analog input. Devices can have buttons and axes.

The device number is assigned by the input module to each input device the first time it is detected in the host system. Once assigned the device keeps the same number each time it is attached to the host system. This assignment is guaranteed across shutting down and restarting the input module. It can be safely used by the scripting module to save input bindings. If the input module is changed the numbers are not valid anymore. It is best to query the input module for specific types of input devices like the mouse or keyboard instead of relying on the assigned numbers.

Axes can be any input control a user can alter between a minimum and maximum range. Axes are always a single value. Input elements moving along more than 1 degree of freedom one individual axis is used for each degree of freedom. A mouse has 2 axes one for X movement and one for Y movement. The same applies to an analog stick on a joystick or gamepad. A 3D mouse or joystick with twist support use 3 axes. Complex input controls like racing can have more than 3 axes.

Todo:
Add information about buttons/axies supporting force feedback.

Constructor & Destructor Documentation

◆ deInputDevice() [1/2]

deInputDevice::deInputDevice ( )

Create input device.

◆ deInputDevice() [2/2]

deInputDevice::deInputDevice ( const deInputDevice device)

Create copy of input device.

◆ ~deInputDevice()

deInputDevice::~deInputDevice ( )

Clean up input device.

Member Function Documentation

◆ GetAxisAt()

deInputDeviceAxis& deInputDevice::GetAxisAt ( int  index) const

Axis at index.

Referenced by GetAxisCount().

◆ GetAxisCount()

int deInputDevice::GetAxisCount ( ) const
inline

Number of axes.

References GetAxisAt(), IndexOfAxisWithID(), operator=(), and SetAxisCount().

◆ GetButtonAt()

deInputDeviceButton& deInputDevice::GetButtonAt ( int  index) const

Button at index.

Referenced by GetButtonCount().

◆ GetButtonCount()

int deInputDevice::GetButtonCount ( ) const
inline

Number of buttons.

References GetButtonAt(), IndexOfButtonWithID(), and SetButtonCount().

◆ GetDisplayImage()

deImage* deInputDevice::GetDisplayImage ( ) const
inline

Image to represent the device in 2D user interfaces or null if not set.

References SetDisplayImage().

◆ GetDisplayModel()

deModel* deInputDevice::GetDisplayModel ( ) const
inline

Model to represent the device in 3D user interfaces or null if not set.

References SetDisplayModel().

◆ GetDisplaySkin()

deSkin* deInputDevice::GetDisplaySkin ( ) const
inline

Skin for display model or null if not set.

References SetDisplaySkin().

◆ GetID()

const decString& deInputDevice::GetID ( ) const
inline

Device identifier.

Unique identifier for the device identifying it across removing and attaching the device to the host system. The prefix is a normalized string that contains only letters, numbers and underscores. It is suitable to be combined with button or axis identifiers to store them in config files as key bindings.

References SetID().

◆ GetName()

const decString& deInputDevice::GetName ( ) const
inline

Display name.

Dispaly name is human readable like for example 'USB Gamepad #1'. The name is unique but not guaranteed to stay the same across restarting the input module or game engine.

References SetName().

◆ IndexOfAxisWithID()

int deInputDevice::IndexOfAxisWithID ( const char *  id) const

Index of axis with identifier or -1 if not found.

Referenced by GetAxisCount().

◆ IndexOfButtonWithID()

int deInputDevice::IndexOfButtonWithID ( const char *  id) const

Index of button with identifier or -1 if not found.

Referenced by GetButtonCount().

◆ operator=()

deInputDevice& deInputDevice::operator= ( const deInputDevice device)

Copy input device.

Referenced by GetAxisCount().

◆ SetAxisCount()

void deInputDevice::SetAxisCount ( int  count)

Set number of axes.

Resets all axes to default values.

Referenced by GetAxisCount().

◆ SetButtonCount()

void deInputDevice::SetButtonCount ( int  count)

Set number of buttons.

Resets all buttons to default values.

Referenced by GetButtonCount().

◆ SetDisplayImage()

void deInputDevice::SetDisplayImage ( deImage image)

Set image to represent the device in 2D user interfaces or null if not set.

Referenced by GetDisplayImage().

◆ SetDisplayModel()

void deInputDevice::SetDisplayModel ( deModel model)

Set model to represent the device in 3D user interfaces or null if not set.

Referenced by GetDisplayModel().

◆ SetDisplaySkin()

void deInputDevice::SetDisplaySkin ( deSkin skin)

Set skin for display model or null if not set.

Referenced by GetDisplaySkin().

◆ SetID()

void deInputDevice::SetID ( const char *  id)

Set identifier.

Referenced by GetID().

◆ SetName()

void deInputDevice::SetName ( const char *  name)

Set Display name.

Referenced by GetName().


The documentation for this class was generated from the following file: