Hiho, here a little proposal for a joystick API in ClanLib 0.7. Major differences to the API in ClanLib 0.7 is the move of the CL_InputAxis, CL_InputButton, etc. into the generic space (i.e. that there doesn't have to be a CL_LinuxJoystick_Axis) and the removal of the dependecy between CL_InputDevice and CL_InputAxis, so that one just has to do a: CL_Joystick::get_device(0)->get_axis(0) instead of the more complicated: CL_Joystick::get_device(0)->get_axis(0)->get_pos(); Grouping of axis, buttons and Co. can be done via wrapper classes around CL_InputDevice. Something I am not sure about is the seperation between _Generic and non-generic classes, after all a user should have the possiblity to create his own CL_InputAxis and Co. customizations and emulation of axis via buttons and stuff like that. Which would mean to either move _Generic into the API or give up the ref-counting nature of the classes. One possible solution could be to handle the refcounting in the axis/button/pointer-group classes. In addition to the old pointer/mouse device, there should also be a 'ball' device, i.e. a device that lets one recevieve relative mouse movements, instead of absolute one. The name 'ball' equals the name that is used by SDL (http://sdldoc.csn.ul.ie/sdljoystickgetball.php) and should be clear enough (in Pingus we call such stuff 'scrollers' but that isn't really any more clear and less generic). // =================================== // === Additions to CL_InputDevice === // =================================== //: Returns the current position of the num's pointing device CL_Point get_pos(int num = 0) const; //: Returns the the current position of the 'num's axis float get_axis(int num) const; //: Returns the name of the device (i.e. 'Microsoft Sidewinder 3D') std::string get_name() const; int get_axis_count() const; int get_pointer_count() const; int get_button_count() const; // ========================================== // === Additions/Changes to CL_InputEvent === // ========================================== enum Type { no_key, pressed, released, - double_clicked, - moved, + pointer_moved, + axis_moved, + ball_moved }; float axis_pos; // ======================================== // === CL_InputAxis/Button/Pointer/Ball === // ======================================== class CL_InputAxis { public: float get_pos() =0; CL_Signal_v1 &sig_move() =0; }; class CL_InputButton { public: bool get_state() =0; CL_Signal_v1 &sig_up() =0; CL_Signal_v1 &sig_down() =0; }; //: Class for absolute pointer movement events (i.e. for clicking in a GUI) class CL_InputPointer { public: CL_Point get_pos() =0; }; //: Class for relative pointer movement events (i.e. for stuff like //: controlling a first person shooter) class CL_InputBall { public: CL_Point get_pos() =0; CL_Signal_v1 &sig_move() =0; }; // ============================== // === CL_InputDevice Wrapper === // ============================== class CL_InputDeviceAxis : public CL_InputAxis { private: CL_InputDevice dev; int num; public: CL_InputAxis(const CL_InputDevice& dev, int num) : device(dev), num(num); float get_pos() const { return dev.get_axis(num); } CL_Signal_v1 &sig_move() { return dev.sig_move(); } }; class CL_InputDeviceButton : public CL_InputAxis { private: CL_InputDevice dev; int num; public: CL_InputAxis(const CL_InputDevice& dev, int num) : device(dev), num(num); bool get_state() const { return dev.get_keycode(num); } CL_Signal_v1 &sig_down() { return dev.sig_down(); } CL_Signal_v1 &sig_up() { return dev.sig_up(); } }; class CL_InputDevicePointer : public CL_InputPointer { private: CL_InputDevice dev; int num; public: CL_InputAxis(const CL_InputDevice& dev, int num) : device(dev), num(num); CL_Point get_pos() const { return dev.get_pos(num); } CL_Signal_v1 &sig_move() { return dev.sig_move(); } }; // ==================================================== // === CL_InputAxisGroup, CL_InputButtonGroup, etc. === // ==================================================== All the group classes inherit from CL_InputAxis and Co. and group the incomming events and such, like they did in CL0.6 class CL_InputButtonGroup { public: void add(CL_InputButton* button, bool delete = true); bool get_state() =0; CL_Signal_v1 &sig_up() =0; CL_Signal_v1 &sig_down() =0; }; etc. // EOF //