1 #ifndef MSP_INPUT_BINDINGS_H_
2 #define MSP_INPUT_BINDINGS_H_
4 #include <msp/datafile/objectloader.h>
5 #include <msp/strings/lexicalcast.h>
18 class Loader: public DataFile::ObjectLoader<Bindings>
21 static ActionMap shared_actions;
27 void init_actions() override;
29 void binding(const std::string &);
30 void device_type(DeviceType);
31 void device_name(const std::string &);
36 DeviceType type = UNSPECIFIED;
47 friend void operator>>(const LexicalConverter &, AxisSide &);
48 friend void operator<<(LexicalConverter &, AxisSide);
53 class Loader: public DataFile::ObjectLoader<Binding>
56 static ActionMap shared_actions;
62 void init_actions() override;
64 void axis(unsigned, AxisSide);
65 void button(unsigned);
66 void key(Key k) { button(k); }
67 void mouse_axis(MouseAxis a, AxisSide s) { axis(a, s); }
68 void mouse_button(MouseButton b) { button(b); }
73 ControlSrcType type = NO_SOURCE;
78 std::vector<DeviceRef> devices;
79 std::vector<Binding> bindings;
82 const std::vector<DeviceRef> &get_devices() const { return devices; }
83 std::vector<Device *> resolve_devices(Device &) const;
84 bool is_compatible(Device &) const;
85 const std::vector<Binding> &get_bindings() const { return bindings; }
87 bool apply_to(ControlScheme &, Device &);