clan::InputDeviceProvider Class Reference - ClanLib SDK
Description: clan::InputDeviceProvider Class Reference

Public Member Functions | List of all members
clan::InputDeviceProvider Class Referenceabstract
clanDisplay Input

Interface for implementing a InputDevice source. More...

`#include <input_device_provider.h>`

Inheritance diagram for clan::InputDeviceProvider:

## Public Member Functions
virtual | ~InputDeviceProvider ()
virtual float | get_axis (int index) const
| Returns the the current position of a joystick axis. (Joysticks only)
virtual std::vector< int > | get_axis_ids () const
| Returns the number of axes available on this device. (Joysticks only)
virtual int | get_button_count () const =0
| Returns the number of buttons available on this device. \warn If used on a keyboard or mouse, this function returns -1.
virtual std::string | get_device_name () const =0
| Return the hardware id/device for this device (i.e. /dev/input/js0)
virtual Point | get_device_position () const
| Returns the current device-supplied x and y position of the device. (Pointing devices only) The returned positional value is in the scale of the physical pixel on the screen.
virtual int | get_hat (int) const
| Returns the current position of a joystick hat. (Joysticks only)
virtual std::string | get_key_name (int id) const =0
| Retrieves the localized friendly key name for specified identifier (i.e. A, B, Leertaste, Backspace, Mouse Left, ...).
virtual bool | get_keycode (int keycode) const =0
| Returns true if the passed key code is down for this device. See `keys.h` for list of key codes.
virtual std::string | get_name () const =0
| Returns the human readable name of the device (i.e. 'Microsoft Sidewinder 3D').
virtual Pointf | get_position () const
| Returns the current device-independent x and y position (DIP) of the device. (Pointing devices only) The returned positional value is scaled to the pixel ratio of the display.
virtual InputDevice::Type | get_type () const =0
| Returns the input device type.
virtual std::string | keyid_to_string (int) const
| Returns a generic string name for the specified key code.
virtual void | set_device_position (int x, int y)
| Sets the actual position of the device. (Pointing devices only)
virtual void | set_position (float x, float y)
| Sets the display-independent position of the device. (Pointing devices only)
virtual int | string_to_keyid (const std::string &) const
| Returns the key code for the specified generic string key name.
virtual bool | supports_keyid_mapping () const
| Returns true if this provider implements keyid to/from string mapping.
Public Member Functions inherited from clan::DisposableObject
| DisposableObject ()
void | dispose ()
bool | is_disposed () const
void | throw_if_disposed () const

## Additional Inherited Members
Protected Member Functions inherited from clan::DisposableObject
virtual void | on_dispose ()=0

## Detailed Description

Interface for implementing a InputDevice source.

## Constructor & Destructor Documentation

## ◆ ~InputDeviceProvider()

virtual clan::InputDeviceProvider::~InputDeviceProvider | ( |  | ) |
| inlinevirtual

## Member Function Documentation

## ◆ get_axis()

virtual float clan::InputDeviceProvider::get_axis | ( | int | index | ) | const
| inlinevirtual

Returns the the current position of a joystick axis. (Joysticks only)

## ◆ get_axis_ids()

virtual std::vector< int > clan::InputDeviceProvider::get_axis_ids | ( |  | ) | const
| inlinevirtual

Returns the number of axes available on this device. (Joysticks only)

## ◆ get_button_count()

virtual int clan::InputDeviceProvider::get_button_count | ( |  | ) | const
| pure virtual

Returns the number of buttons available on this device. \warn If used on a keyboard or mouse, this function returns -1.

## ◆ get_device_name()

virtual std::string clan::InputDeviceProvider::get_device_name | ( |  | ) | const
| pure virtual

Return the hardware id/device for this device (i.e. /dev/input/js0)

## ◆ get_device_position()

virtual Point clan::InputDeviceProvider::get_device_position | ( |  | ) | const
| inlinevirtual

Returns the current device-supplied x and y position of the device. (Pointing devices only) The returned positional value is in the scale of the physical pixel on the screen.

## ◆ get_hat()

virtual int clan::InputDeviceProvider::get_hat | ( | int |  | ) | const
| inlinevirtual

Returns the current position of a joystick hat. (Joysticks only)

Returns
  Hat direction in degrees (0-360), or -1 if the hat is centered.

## ◆ get_key_name()

virtual std::string clan::InputDeviceProvider::get_key_name | ( | int | id | ) | const
| pure virtual

Retrieves the localized friendly key name for specified identifier (i.e. A, B, Leertaste, Backspace, Mouse Left, ...).

Note
  The returned name for the key may be localized by the system; it

## ◆ get_keycode()

virtual bool clan::InputDeviceProvider::get_keycode | ( | int | keycode | ) | const
| pure virtual

Returns true if the passed key code is down for this device. See `keys.h` for list of key codes.

## ◆ get_name()

virtual std::string clan::InputDeviceProvider::get_name | ( |  | ) | const
| pure virtual

Returns the human readable name of the device (i.e. 'Microsoft Sidewinder 3D').

## ◆ get_position()

virtual Pointf clan::InputDeviceProvider::get_position | ( |  | ) | const
| inlinevirtual

Returns the current device-independent x and y position (DIP) of the device. (Pointing devices only) The returned positional value is scaled to the pixel ratio of the display.

## ◆ get_type()

virtual InputDevice::Type clan::InputDeviceProvider::get_type | ( |  | ) | const
| pure virtual

Returns the input device type.

## ◆ keyid_to_string()

virtual std::string clan::InputDeviceProvider::keyid_to_string | ( | int |  | ) | const
| inlinevirtual

Returns a generic string name for the specified key code.

## ◆ set_device_position()

virtual void clan::InputDeviceProvider::set_device_position | ( | int | x,
|  | int | y )
| inlinevirtual

Sets the actual position of the device. (Pointing devices only)

## ◆ set_position()

virtual void clan::InputDeviceProvider::set_position | ( | float | x,
|  | float | y )
| inlinevirtual

Sets the display-independent position of the device. (Pointing devices only)

## ◆ string_to_keyid()

virtual int clan::InputDeviceProvider::string_to_keyid | ( | const std::string & |  | ) | const
| inlinevirtual

Returns the key code for the specified generic string key name.

## ◆ supports_keyid_mapping()

virtual bool clan::InputDeviceProvider::supports_keyid_mapping | ( |  | ) | const
| inlinevirtual

Returns true if this provider implements keyid to/from string mapping.

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

- input_device_provider.h