#include <input_device.h>
Public Types | |
enum | Type { keyboard, pointer, joystick, tablet, unknown } |
Input device types. More... | |
Public Member Functions | |
Construction | |
InputDevice () | |
Constructs a null instance. More... | |
InputDevice (InputDeviceProvider *provider) | |
Constructs a InputDevice. More... | |
InputDevice (std::weak_ptr< InputDevice_Impl > impl) | |
Constructs a InputDevice. More... | |
~InputDevice () | |
Attributes | |
bool | is_null () const |
Returns true if this object is invalid. More... | |
void | throw_if_null () const |
Throw an exception if this object is invalid. More... | |
InputDeviceProvider * | get_provider () const |
Returns the provider for this input device. More... | |
std::string | get_name () const |
Returns the human readable name of the device (i.e. 'Microsoft Sidewinder 3D'). More... | |
std::string | get_device_name () const |
Return the hardware id/device for this device (i.e. /dev/input/js0) More... | |
Type | get_type () const |
Returns the input device type. More... | |
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, ...). More... | |
std::string | keyid_to_string (int keycode) const |
Returns a generic string name for the specified key code. More... | |
int | string_to_keyid (const std::string &str) const |
Returns the key code for the specified generic string key name. More... | |
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. More... | |
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. More... | |
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. More... | |
float | get_axis (int axisid) const |
Returns the the current position of a joystick axis. (Joysticks only) More... | |
std::vector< int > | get_axis_ids () const |
Returns the number of axes available on this device. (Joysticks only) More... | |
int | get_hat (int index) const |
Returns the current position of a joystick hat. (Joysticks only) More... | |
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. More... | |
bool | in_proximity () const |
Returns true if the input device is in proximity mode. (Tablets only) More... | |
Operations | |
InputDevice & | operator= (const InputDevice ©) |
void | set_position (float x, float y) |
Sets the display-independent position of the device. (Pointing devices only) More... | |
void | set_device_position (int x, int y) |
Sets the actual position of the device. (Pointing devices only) More... | |
Signals | |
Signal< void(const InputEvent &)> & | sig_key_down () |
Signal emitted when key is pressed. More... | |
Signal< void(const InputEvent &)> & | sig_key_up () |
Signal emitted when key is released. More... | |
Signal< void(const InputEvent &)> & | sig_pointer_move () |
Signal emitted when pointer is moved (absolute movement). More... | |
Signal< void(const InputEvent &)> & | sig_axis_move () |
Signal emitted when axis is moved. More... | |
Signal< void(const InputEvent &)> & | sig_key_dblclk () |
Signal emitted when the mouse is double-clicked. More... | |
Signal< void(const InputEvent &)> & | sig_proximity_change () |
Signal emitted when proximity is entered or exited. More... | |
Implementation | |
class | InputContext_Impl |