1 #ifndef MSP_INPUT_BINDINGS_H_
2 #define MSP_INPUT_BINDINGS_H_
4 #include <msp/datafile/objectloader.h>
5 #include <msp/graphics/mspgui_api.h>
6 #include <msp/strings/lexicalcast.h>
16 class MSPGUI_API Bindings
19 class MSPGUI_API Loader: public DataFile::ObjectLoader<Bindings>
22 static ActionMap shared_actions;
28 void init_actions() override;
30 void binding(const std::string &);
31 void device_type(DeviceType);
32 void device_name(const std::string &);
37 DeviceType type = UNSPECIFIED;
48 friend void operator>>(const LexicalConverter &, AxisSide &);
49 friend void operator<<(LexicalConverter &, AxisSide);
54 class Loader: public DataFile::ObjectLoader<Binding>
57 static ActionMap shared_actions;
63 void init_actions() override;
65 void axis(unsigned, AxisSide);
66 void button(unsigned);
67 void key(Key k) { button(k); }
68 void mouse_axis(MouseAxis a, AxisSide s) { axis(a, s); }
69 void mouse_button(MouseButton b) { button(b); }
74 ControlSrcType type = NO_SOURCE;
79 std::vector<DeviceRef> devices;
80 std::vector<Binding> bindings;
83 const std::vector<DeviceRef> &get_devices() const { return devices; }
84 std::vector<Device *> resolve_devices(Device &) const;
85 bool is_compatible(Device &) const;
86 const std::vector<Binding> &get_bindings() const { return bindings; }
88 bool apply_to(ControlScheme &, Device &);