#include <input_device.h>
Public Types | |
| enum | Type { keyboard , pointer , joystick , unknown } |
| Input device types. More... | |
Public Member Functions | |
| InputDevice () | |
| Constructs a null instance. | |
| InputDevice (InputDeviceProvider *provider) | |
| Constructs a InputDevice. | |
| InputDevice (std::weak_ptr< InputDevice_Impl > impl) | |
| Constructs a InputDevice. | |
| ~InputDevice () | |
| float | get_axis (int axisid) const |
| Returns the the current position of a joystick axis. (Joysticks only) | |
| std::vector< int > | get_axis_ids () const |
| Returns the number of axes available on this device. (Joysticks only) | |
| int | get_button_count () const |
| Returns the number of buttons available on this device. \warn If used on a keyboard or mouse, this function returns -1. | |
| std::string | get_device_name () const |
| Return the hardware id/device for this device (i.e. /dev/input/js0) | |
| Point | get_device_position () const |
| Returns the current devicesice-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. | |
| int | get_hat (int index) const |
| Returns the current position of a joystick hat. (Joysticks only) | |
| std::string | get_key_name (int id) const |
| Retrieves the localized friendly key name for specified identifier (i.e. A, B, Leertaste, Backspace, Mouse Left, ...). | |
| bool | get_keycode (int keycode) const |
Returns true if the passed key code is down for this device. See keys.h for list of key codes. | |
| std::string | get_name () const |
| Returns the human readable name of the device (i.e. 'Microsoft Sidewinder 3D'). | |
| 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. | |
| InputDeviceProvider * | get_provider () const |
| Returns the provider for this input device. | |
| Type | get_type () const |
| Returns the input device type. | |
| bool | is_null () const |
| Returns true if this object is invalid. | |
| std::string | keyid_to_string (int keycode) const |
| Returns a generic string name for the specified key code. | |
| operator bool () const | |
| InputDevice & | operator= (const InputDevice ©) |
| void | set_device_position (int x, int y) |
| Sets the actual position of the device. (Pointing devices only) | |
| void | set_position (float x, float y) |
| Sets the display-independent position of the device. (Pointing devices only) | |
| Signal< void(const InputEvent &)> & | sig_axis_move () |
| Signal emitted when axis is moved. | |
| Signal< void(const InputEvent &)> & | sig_key_dblclk () |
| Signal emitted when the mouse is double-clicked. | |
| Signal< void(const InputEvent &)> & | sig_key_down () |
| Signal emitted when key is pressed. | |
| Signal< void(const InputEvent &)> & | sig_key_up () |
| Signal emitted when key is released. | |
| Signal< void(const InputEvent &)> & | sig_pointer_move () |
| Signal emitted when pointer is moved (absolute movement). | |
| Signal< void(const InputEvent &)> & | sig_proximity_change () |
| Signal emitted when proximity is entered or exited. | |
| int | string_to_keyid (const std::string &str) const |
| Returns the key code for the specified generic string key name. | |
| void | throw_if_null () const |
| Throw an exception if this object is invalid. | |
| clan::InputDevice::InputDevice | ( | ) |
Constructs a null instance.
| clan::InputDevice::InputDevice | ( | InputDeviceProvider * | provider | ) |
Constructs a InputDevice.
| provider | = Input Device Provider |
| clan::InputDevice::InputDevice | ( | std::weak_ptr< InputDevice_Impl > | impl | ) |
Constructs a InputDevice.
| impl | = Weak Ptr |
| clan::InputDevice::~InputDevice | ( | ) |
| float clan::InputDevice::get_axis | ( | int | axisid | ) | const |
Returns the the current position of a joystick axis. (Joysticks only)
| std::vector< int > clan::InputDevice::get_axis_ids | ( | ) | const |
Returns the number of axes available on this device. (Joysticks only)
| int clan::InputDevice::get_button_count | ( | ) | const |
Returns the number of buttons available on this device. \warn If used on a keyboard or mouse, this function returns -1.
| std::string clan::InputDevice::get_device_name | ( | ) | const |
Return the hardware id/device for this device (i.e. /dev/input/js0)
| Point clan::InputDevice::get_device_position | ( | ) | const |
Returns the current devicesice-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.
| int clan::InputDevice::get_hat | ( | int | index | ) | const |
Returns the current position of a joystick hat. (Joysticks only)
| std::string clan::InputDevice::get_key_name | ( | int | id | ) | const |
Retrieves the localized friendly key name for specified identifier (i.e. A, B, Leertaste, Backspace, Mouse Left, ...).
| bool clan::InputDevice::get_keycode | ( | int | keycode | ) | const |
Returns true if the passed key code is down for this device. See keys.h for list of key codes.
| std::string clan::InputDevice::get_name | ( | ) | const |
Returns the human readable name of the device (i.e. 'Microsoft Sidewinder 3D').
| Pointf clan::InputDevice::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.
| InputDeviceProvider * clan::InputDevice::get_provider | ( | ) | const |
Returns the provider for this input device.
| Type clan::InputDevice::get_type | ( | ) | const |
Returns the input device type.
|
inline |
Returns true if this object is invalid.
| std::string clan::InputDevice::keyid_to_string | ( | int | keycode | ) | const |
Returns a generic string name for the specified key code.
|
inlineexplicit |
| InputDevice & clan::InputDevice::operator= | ( | const InputDevice & | copy | ) |
| void clan::InputDevice::set_device_position | ( | int | x, |
| int | y ) |
Sets the actual position of the device. (Pointing devices only)
| void clan::InputDevice::set_position | ( | float | x, |
| float | y ) |
Sets the display-independent position of the device. (Pointing devices only)
| Signal< void(const InputEvent &)> & clan::InputDevice::sig_axis_move | ( | ) |
Signal emitted when axis is moved.
| Signal< void(const InputEvent &)> & clan::InputDevice::sig_key_dblclk | ( | ) |
Signal emitted when the mouse is double-clicked.
| Signal< void(const InputEvent &)> & clan::InputDevice::sig_key_down | ( | ) |
Signal emitted when key is pressed.
| Signal< void(const InputEvent &)> & clan::InputDevice::sig_key_up | ( | ) |
Signal emitted when key is released.
| Signal< void(const InputEvent &)> & clan::InputDevice::sig_pointer_move | ( | ) |
Signal emitted when pointer is moved (absolute movement).
| Signal< void(const InputEvent &)> & clan::InputDevice::sig_proximity_change | ( | ) |
Signal emitted when proximity is entered or exited.
| int clan::InputDevice::string_to_keyid | ( | const std::string & | str | ) | const |
Returns the key code for the specified generic string key name.
| void clan::InputDevice::throw_if_null | ( | ) | const |
Throw an exception if this object is invalid.