Public Member Functions

gamepad::Map Class Reference

A gamepad::Map is the magical binding between physical inputs (button presses, joystick moves, wheel turns) and logical events (left top trigger pressed, right joystick pushed up, etc. More...

#include <gamepad-map.h>

Inheritance diagram for gamepad::Map:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual ~Map (void) throw ()
virtual const char * getId (void) const =0 throw ()
 returns the ID of this mapping. IDs should be UUIDs
virtual const char * getTypeId (void) const =0 throw ()
 returns the ID of the gamepad type this mapping is for (also UUID)
virtual const char * getName (void) const =0 throw ()
 returns the name of this mapping.
virtual const VecString & getDeviceNames (void) const =0 throw ()
 returns the list of device names for which this mapping is recommended.
virtual const button_map_tgetButtonMapping (IN const char *logicalName) const =0 throw ()
 given a button index for the gamepad (see gamepad::Type), how is it mapped to buttons or potentiometers? Returns NULL on error (usually because the logicalName isn't recognized).
virtual const joystick_map_tgetJoystickMapping (IN const char *logicalName) const =0 throw ()
 given a joystick index for the gamepad, how is it mapped to potentiometers? Returns NULL on error.
virtual const pot_map_tgetPotMapping (IN const char *logicalName) const =0 throw ()
 given an potentiometer index for the gamepad (see gamepad::Type), what is the corresponding potentiometer index on the source device? Returns NULL on error.
virtual const dpad_map_tgetDpadMapping (IN const char *logicalName) const =0 throw ()
 given a dpad index for the gamepad (see gamepad::Type), what is the corresponding dpad index on the source device? Returns NULL on error.

Detailed Description

A gamepad::Map is the magical binding between physical inputs (button presses, joystick moves, wheel turns) and logical events (left top trigger pressed, right joystick pushed up, etc.

). In practice, there is no agreement between manufacturers how physical and logical events are related. So, for instance, different manufacturers will produce USB adapters that represent the exact same gamepad completely differently. In short, based on the state of the world today, there is no way for a programmer to know what type of gamepad a player is holding, or how to interpret the events coming from that device. The gamepad::Map performs that mapping, and most of the purpose of this entire API is to provide easy-to-create and manage gamepad mappings so that programmers can work with gamepad objects and not worry about the underlying details. This particular object gamepad::Map is fairly low-level and is designed to be easily persisted. Users of the gamepad library will probably want to use the Gamepad object instead, which is intended to represent the physical instance of a connected gamepad.

Definition at line 238 of file gamepad-map.h.


Constructor & Destructor Documentation

gamepad::Map::~Map ( void   )  throw () [virtual]

Definition at line 39 of file gamepad-map.cpp.


Member Function Documentation

virtual const char* gamepad::Map::getId ( void   )  const throw () [pure virtual]

returns the ID of this mapping. IDs should be UUIDs

virtual const char* gamepad::Map::getTypeId ( void   )  const throw () [pure virtual]

returns the ID of the gamepad type this mapping is for (also UUID)

virtual const char* gamepad::Map::getName ( void   )  const throw () [pure virtual]

returns the name of this mapping.

This is for debugging and is not meant for end users.

virtual const VecString& gamepad::Map::getDeviceNames ( void   )  const throw () [pure virtual]

returns the list of device names for which this mapping is recommended.

A device name is the same as what is returned from gamepad::SourceDevice::getPublicName(). That is, it should be the device name as returned directly by the hardware itself. This list can be empty, and there could be multiple mappings that claim to support the same device. This is especially true for source devices that support multiple gamepads.

virtual const button_map_t* gamepad::Map::getButtonMapping ( IN const char *  logicalName  )  const throw () [pure virtual]

given a button index for the gamepad (see gamepad::Type), how is it mapped to buttons or potentiometers? Returns NULL on error (usually because the logicalName isn't recognized).

virtual const joystick_map_t* gamepad::Map::getJoystickMapping ( IN const char *  logicalName  )  const throw () [pure virtual]

given a joystick index for the gamepad, how is it mapped to potentiometers? Returns NULL on error.

virtual const pot_map_t* gamepad::Map::getPotMapping ( IN const char *  logicalName  )  const throw () [pure virtual]

given an potentiometer index for the gamepad (see gamepad::Type), what is the corresponding potentiometer index on the source device? Returns NULL on error.

virtual const dpad_map_t* gamepad::Map::getDpadMapping ( IN const char *  logicalName  )  const throw () [pure virtual]

given a dpad index for the gamepad (see gamepad::Type), what is the corresponding dpad index on the source device? Returns NULL on error.


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