1 #include <msp/strings/formatter.h>
7 bool Device::get_button_state(unsigned btn) const
15 float Device::get_axis_value(unsigned axis) const
23 std::string Device::get_button_name(unsigned btn) const
25 return format("Button %d", btn);
28 std::string Device::get_axis_name(unsigned axis) const
30 return format("Axis %d", axis);
33 void Device::set_button_state(unsigned btn, bool state, bool event)
35 if(btn>=buttons.size())
36 buttons.resize(btn+1, false);
38 if(state!=buttons[btn])
45 signal_button_press.emit(btn);
47 signal_button_release.emit(btn);
52 void Device::set_axis_value(unsigned axis, float value, bool event)
55 axes.resize(axis+1, 0);
59 float old = axes[axis];
63 signal_axis_motion.emit(axis, value, value-old);