3 This file is part of libmspgbase
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
8 #include <sigc++/bind.h>
14 unsigned Hub::attach(Device &dev)
16 unsigned index=devices.size();
17 devices.push_back(&dev);
18 dev.signal_button_press.connect(sigc::bind(sigc::mem_fun(this, &Hub::button_press), index));
19 dev.signal_button_release.connect(sigc::bind(sigc::mem_fun(this, &Hub::button_release), index));
20 dev.signal_axis_motion.connect(sigc::bind(sigc::mem_fun(this, &Hub::axis_motion), index));
24 void Hub::button_press(unsigned btn, unsigned index)
26 set_button_state(index<<8 | btn&0xFF, true, true);
29 void Hub::button_release(unsigned btn, unsigned index)
31 set_button_state(index<<8 | btn&0xFF, false, true);
34 void Hub::axis_motion(unsigned axis, float value, float, unsigned index)
36 set_axis_value(index<<8 | axis&0xFF, value, true);