X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Finput%2Fdevice.h;h=4544776ac3a36f1f6b36d7dfe0d7a79cdaacb232;hb=24da3e62cf22663ef16b61b9510fbac49308f756;hp=b42ed3fde4991feb8d87b05258831585db57efec;hpb=e217a93d59aecfa80eec8bfa16b3976abdceca81;p=libs%2Fgui.git diff --git a/source/input/device.h b/source/input/device.h index b42ed3f..4544776 100644 --- a/source/input/device.h +++ b/source/input/device.h @@ -5,6 +5,7 @@ #include #include #include +#include namespace Msp { namespace Input { @@ -17,6 +18,16 @@ public: }; +enum DeviceType +{ + UNSPECIFIED, + KEYBOARD, + MOUSE, + TOUCH_SURFACE, + GAME_CONTROLLER +}; + + /** Base class for input devices. Input devices have two types of controls: buttons and axes. Buttons are either on or off. Axes have a floating point @@ -47,15 +58,19 @@ public: sigc::signal::accumulated signal_axis_motion; protected: + DeviceType type; std::string name; std::vector buttons; std::vector axes; - Device(); + Device(DeviceType); public: virtual ~Device(); + DeviceType get_type() const { return type; } const std::string &get_name() const { return name; } + virtual Device *find_subdevice(DeviceType, unsigned = 0); + virtual Device *find_subdevice(const std::string &); bool get_button_state(unsigned) const; float get_axis_value(unsigned) const; @@ -66,6 +81,10 @@ protected: void set_axis_value(unsigned, float, bool); }; + +void operator>>(const LexicalConverter &, DeviceType &); +void operator<<(LexicalConverter &, DeviceType); + } // namespace Input } // namespace Msp