Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
KODI::JOYSTICK::CDriverPrimitive Class Reference

Basic driver element associated with input events. More...

#include <DriverPrimitive.h>

Public Member Functions

 CDriverPrimitive (void)
 Construct an invalid driver primitive.
 
 CDriverPrimitive (PRIMITIVE_TYPE type, unsigned int index)
 Construct a driver primitive representing a button or motor.
 
 CDriverPrimitive (unsigned int hatIndex, HAT_DIRECTION direction)
 Construct a driver primitive representing one of the four direction arrows on a dpad.
 
 CDriverPrimitive (unsigned int axisIndex, int center, SEMIAXIS_DIRECTION direction, unsigned int range)
 Construct a driver primitive representing the positive or negative half of an axis.
 
 CDriverPrimitive (KEYBOARD::XBMCKey keycode)
 Construct a driver primitive representing a key on a keyboard.
 
 CDriverPrimitive (MOUSE::BUTTON_ID index)
 Construct a driver primitive representing a mouse button.
 
 CDriverPrimitive (RELATIVE_POINTER_DIRECTION direction)
 Construct a driver primitive representing a relative pointer.
 
bool operator== (const CDriverPrimitive &rhs) const
 
bool operator< (const CDriverPrimitive &rhs) const
 
bool operator!= (const CDriverPrimitive &rhs) const
 
bool operator> (const CDriverPrimitive &rhs) const
 
bool operator<= (const CDriverPrimitive &rhs) const
 
bool operator>= (const CDriverPrimitive &rhs) const
 
PRIMITIVE_TYPE Type (void) const
 The type of driver primitive.
 
unsigned int Index (void) const
 The index used by the joystick driver.
 
HAT_DIRECTION HatDirection (void) const
 The direction arrow (valid for hat directions)
 
int Center () const
 The location of the zero point of the semiaxis.
 
SEMIAXIS_DIRECTION SemiAxisDirection (void) const
 The semiaxis direction (valid for semiaxes)
 
unsigned int Range () const
 The distance between the center and the farthest valid value (valid for semiaxes)
 
KEYBOARD::XBMCKey Keycode () const
 The keyboard symbol (valid for keys)
 
MOUSE::BUTTON_ID MouseButton () const
 The mouse button ID (valid for mouse buttons)
 
RELATIVE_POINTER_DIRECTION PointerDirection () const
 The relative pointer direction (valid for relative pointers)
 
bool IsValid (void) const
 Test if an driver primitive is valid.
 
std::string ToString () const
 Convert primitive to a string suitable for logging.
 

Detailed Description

Basic driver element associated with input events.

Driver input (bools, floats and enums) is split into primitives that better map to the physical features on a joystick.

A bool obviously only maps to a single feature, so it is a driver primitive. Here, these are called "buttons".

A hat enum encodes the state of the four hat directions. Each direction can map to a different feature, so a hat enum consists of four driver primitives called "hat directions".

A float is a little trickier. Trivially, it can map to an analog stick or trigger. However, DirectInput combines two triggers onto a single axis. Therefore, the axis is split into two primitives called "semiaxes".

The type determines the fields in use:

Button:

  • driver index

Hat direction:

  • driver index
  • hat direction (up/right/down/left)

Semiaxis:

  • driver index
  • center (-1, 0 or 1)
  • semiaxis direction (positive/negative)
  • range (1 or 2)

Motor:

  • driver index

Key:

  • keycode

Mouse button:

  • driver index

Relative pointer:

  • pointer direction

For more info, see "Chapter 2. Joystick drivers" in the documentation thread: http://forum.kodi.tv/showthread.php?tid=257764

Constructor & Destructor Documentation

◆ CDriverPrimitive() [1/7]

CDriverPrimitive::CDriverPrimitive ( void )
default

Construct an invalid driver primitive.

◆ CDriverPrimitive() [2/7]

CDriverPrimitive::CDriverPrimitive ( PRIMITIVE_TYPE type,
unsigned int index )

Construct a driver primitive representing a button or motor.

◆ CDriverPrimitive() [3/7]

CDriverPrimitive::CDriverPrimitive ( unsigned int hatIndex,
HAT_DIRECTION direction )

Construct a driver primitive representing one of the four direction arrows on a dpad.

◆ CDriverPrimitive() [4/7]

CDriverPrimitive::CDriverPrimitive ( unsigned int axisIndex,
int center,
SEMIAXIS_DIRECTION direction,
unsigned int range )

Construct a driver primitive representing the positive or negative half of an axis.

◆ CDriverPrimitive() [5/7]

CDriverPrimitive::CDriverPrimitive ( KEYBOARD::XBMCKey keycode)

Construct a driver primitive representing a key on a keyboard.

◆ CDriverPrimitive() [6/7]

CDriverPrimitive::CDriverPrimitive ( MOUSE::BUTTON_ID index)

Construct a driver primitive representing a mouse button.

◆ CDriverPrimitive() [7/7]

CDriverPrimitive::CDriverPrimitive ( RELATIVE_POINTER_DIRECTION direction)

Construct a driver primitive representing a relative pointer.

Member Function Documentation

◆ Center()

int KODI::JOYSTICK::CDriverPrimitive::Center ( ) const
inline

The location of the zero point of the semiaxis.

◆ HatDirection()

HAT_DIRECTION KODI::JOYSTICK::CDriverPrimitive::HatDirection ( void ) const
inline

The direction arrow (valid for hat directions)

◆ Index()

unsigned int KODI::JOYSTICK::CDriverPrimitive::Index ( void ) const
inline

The index used by the joystick driver.

Valid for:

  • buttons
  • hats
  • semiaxes
  • motors

◆ IsValid()

bool CDriverPrimitive::IsValid ( void ) const

Test if an driver primitive is valid.

A driver primitive is valid if it has a known type and:

1) for hats, it is a cardinal direction 2) for semi-axes, it is a positive or negative direction 3) for keys, the keycode is non-empty

◆ Keycode()

KEYBOARD::XBMCKey KODI::JOYSTICK::CDriverPrimitive::Keycode ( ) const
inline

The keyboard symbol (valid for keys)

◆ MouseButton()

MOUSE::BUTTON_ID KODI::JOYSTICK::CDriverPrimitive::MouseButton ( ) const
inline

The mouse button ID (valid for mouse buttons)

◆ operator!=()

bool KODI::JOYSTICK::CDriverPrimitive::operator!= ( const CDriverPrimitive & rhs) const
inline

◆ operator<()

bool CDriverPrimitive::operator< ( const CDriverPrimitive & rhs) const

◆ operator<=()

bool KODI::JOYSTICK::CDriverPrimitive::operator<= ( const CDriverPrimitive & rhs) const
inline

◆ operator==()

bool CDriverPrimitive::operator== ( const CDriverPrimitive & rhs) const

◆ operator>()

bool KODI::JOYSTICK::CDriverPrimitive::operator> ( const CDriverPrimitive & rhs) const
inline

◆ operator>=()

bool KODI::JOYSTICK::CDriverPrimitive::operator>= ( const CDriverPrimitive & rhs) const
inline

◆ PointerDirection()

RELATIVE_POINTER_DIRECTION KODI::JOYSTICK::CDriverPrimitive::PointerDirection ( ) const
inline

The relative pointer direction (valid for relative pointers)

◆ Range()

unsigned int KODI::JOYSTICK::CDriverPrimitive::Range ( ) const
inline

The distance between the center and the farthest valid value (valid for semiaxes)

◆ SemiAxisDirection()

SEMIAXIS_DIRECTION KODI::JOYSTICK::CDriverPrimitive::SemiAxisDirection ( void ) const
inline

The semiaxis direction (valid for semiaxes)

◆ ToString()

std::string CDriverPrimitive::ToString ( ) const

Convert primitive to a string suitable for logging.

Returns
The primitive as described by a short string, or empty if invalid

◆ Type()

PRIMITIVE_TYPE KODI::JOYSTICK::CDriverPrimitive::Type ( void ) const
inline

The type of driver primitive.


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