ClanLib
2.3.7
|
#include <input_device.h>
Public Types | |
enum | Type { keyboard, pointer, joystick, tablet, unknown } |
Input device types. More... | |
Public Member Functions | |
Construction | |
CL_InputDevice () | |
Constructs a null instance. More... | |
CL_InputDevice (CL_InputDeviceProvider *provider) | |
Constructs a InputDevice. More... | |
CL_InputDevice (CL_WeakPtr< CL_InputDevice_Impl > impl) | |
Constructs a InputDevice. More... | |
~CL_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... | |
CL_InputDeviceProvider * | get_provider () const |
Returns the provider for this input device. More... | |
CL_String | get_name () const |
Returns the human readable name of the device (i.e. 'Microsoft Sidewinder 3D'). More... | |
CL_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... | |
CL_String | get_key_name (int id) const |
Friendly key name for specified identifier (A, B, Leertaste, Backspace, Mouse Left, ...). More... | |
CL_String | keyid_to_string (int keycode) const |
Returns a generic string name for the specified key code. More... | |
int | string_to_keyid (const CL_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. More... | |
CL_Point | get_position () const |
Returns the position (x,y) of the device. More... | |
int | get_x () const |
Returns the x position of the device. More... | |
int | get_y () const |
Returns the y position of the device. More... | |
double | get_axis (int index) const |
Returns the the current position of a joystick axis. More... | |
int | get_axis_count () const |
Returns the number of axes available on this device. More... | |
int | get_button_count () const |
Returns the number of buttons available on this device. More... | |
bool | in_proximity () const |
Returns true if the input device is in proximity (applicable for tablets). More... | |
Operations | |
CL_InputDevice & | operator= (const CL_InputDevice ©) |
void | set_position (int x, int y) |
Sets the position of the device. More... | |
bool | poll (bool peek_only) |
Update device. More... | |
Signals | |
CL_Signal_v2< const CL_InputEvent &, const CL_InputState & > & | sig_key_down () |
Signal emitted when key is pressed. More... | |
CL_Signal_v2< const CL_InputEvent &, const CL_InputState & > & | sig_key_up () |
Signal emitted when key is released. More... | |
CL_Signal_v2< const CL_InputEvent &, const CL_InputState & > & | sig_pointer_move () |
Signal emitted when pointer is moved (absolute movement). More... | |
CL_Signal_v2< const CL_InputEvent &, const CL_InputState & > & | sig_axis_move () |
Signal emitted when axis is moved. More... | |
CL_Signal_v2< const CL_InputEvent &, const CL_InputState & > & | sig_key_dblclk () |
Signal emitted when the mouse is double-clicked. More... | |
CL_Signal_v2< const CL_InputEvent &, const CL_InputState & > & | sig_proximity_change () |
Signal emitted when proximity is entered or exited. More... | |
Implementation | |
class | CL_InputContext_Impl |
enum CL_InputDevice::Type |
CL_InputDevice::CL_InputDevice | ( | ) |
Constructs a null instance.
CL_InputDevice::CL_InputDevice | ( | CL_InputDeviceProvider * | provider) |
Constructs a InputDevice.
provider | = Input Device Provider |
CL_InputDevice::CL_InputDevice | ( | CL_WeakPtr< CL_InputDevice_Impl > | impl) |
Constructs a InputDevice.
impl | = Weak Ptr |
CL_InputDevice::~CL_InputDevice | ( | ) |
double CL_InputDevice::get_axis | ( | int | index) | const |
Returns the the current position of a joystick axis.
int CL_InputDevice::get_axis_count | ( | ) | const |
Returns the number of axes available on this device.
int CL_InputDevice::get_button_count | ( | ) | const |
Returns the number of buttons available on this device.
If used on a keyboard, this function returns -1.
CL_String CL_InputDevice::get_device_name | ( | ) | const |
Return the hardware id/device for this device (i.e. /dev/input/js0)
CL_String CL_InputDevice::get_key_name | ( | int | id) | const |
Friendly key name for specified identifier (A, B, Leertaste, Backspace, Mouse Left, ...).
Note that this key name is localized, meaning it should only be used for menus where the user view key bindings, and not configuration files and such.
bool CL_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.
CL_String CL_InputDevice::get_name | ( | ) | const |
Returns the human readable name of the device (i.e. 'Microsoft Sidewinder 3D').
CL_Point CL_InputDevice::get_position | ( | ) | const |
Returns the position (x,y) of the device.
Only valid for pointer devices.
CL_InputDeviceProvider* CL_InputDevice::get_provider | ( | ) | const |
Returns the provider for this input device.
Type CL_InputDevice::get_type | ( | ) | const |
Returns the input device type.
int CL_InputDevice::get_x | ( | ) | const |
Returns the x position of the device.
Only valid for pointer devices.
int CL_InputDevice::get_y | ( | ) | const |
Returns the y position of the device.
Only valid for pointer devices.
bool CL_InputDevice::in_proximity | ( | ) | const |
Returns true if the input device is in proximity (applicable for tablets).
Always returns false for non-tablet devices
|
inline |
Returns true if this object is invalid.
CL_String CL_InputDevice::keyid_to_string | ( | int | keycode) | const |
Returns a generic string name for the specified key code.
CL_InputDevice& CL_InputDevice::operator= | ( | const CL_InputDevice & | copy) |
bool CL_InputDevice::poll | ( | bool | peek_only) |
Update device.
peek_only | Treat as a request to see if an event would occur |
void CL_InputDevice::set_position | ( | int | x, |
int | y | ||
) |
Sets the position of the device.
Only valid for mouse.
CL_Signal_v2<const CL_InputEvent &, const CL_InputState &>& CL_InputDevice::sig_axis_move | ( | ) |
Signal emitted when axis is moved.
CL_Signal_v2<const CL_InputEvent &, const CL_InputState &>& CL_InputDevice::sig_key_dblclk | ( | ) |
Signal emitted when the mouse is double-clicked.
CL_Signal_v2<const CL_InputEvent &, const CL_InputState &>& CL_InputDevice::sig_key_down | ( | ) |
Signal emitted when key is pressed.
CL_Signal_v2<const CL_InputEvent &, const CL_InputState &>& CL_InputDevice::sig_key_up | ( | ) |
Signal emitted when key is released.
CL_Signal_v2<const CL_InputEvent &, const CL_InputState &>& CL_InputDevice::sig_pointer_move | ( | ) |
Signal emitted when pointer is moved (absolute movement).
CL_Signal_v2<const CL_InputEvent &, const CL_InputState &>& CL_InputDevice::sig_proximity_change | ( | ) |
Signal emitted when proximity is entered or exited.
int CL_InputDevice::string_to_keyid | ( | const CL_String & | str) | const |
Returns the key code for the specified generic string key name.
void CL_InputDevice::throw_if_null | ( | ) | const |
Throw an exception if this object is invalid.
|
friend |