1 #include <msp/strings/format.h>
13 bool Device::get_button_state(unsigned btn) const
15 if(btn>=buttons.size())
21 float Device::get_axis_value(unsigned axis) const
29 std::string Device::get_button_name(unsigned btn) const
31 return format("Button %d", btn);
34 std::string Device::get_axis_name(unsigned axis) const
36 return format("Axis %d", axis);
39 void Device::set_button_state(unsigned btn, bool state, bool event)
41 if(btn>=buttons.size())
42 buttons.resize(btn+1, false);
44 if(state!=buttons[btn])
51 signal_button_press.emit(btn);
53 signal_button_release.emit(btn);
58 void Device::set_axis_value(unsigned axis, float value, bool event)
61 axes.resize(axis+1, 0);
65 float old = axes[axis];
69 signal_axis_motion.emit(axis, value, value-old);