settings: Add Native type for mouse buttons
This commit is contained in:
parent
0c3e7b7086
commit
152422bab1
|
@ -132,4 +132,11 @@ using MotionDevice = InputDevice<std::tuple<Math::Vec3<float>, Math::Vec3<float>
|
||||||
*/
|
*/
|
||||||
using TouchDevice = InputDevice<std::tuple<float, float, bool>>;
|
using TouchDevice = InputDevice<std::tuple<float, float, bool>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A mouse device is an input device that returns a tuple of two floats and four ints.
|
||||||
|
* The first two floats are X and Y device coordinates of the mouse (from 0-1).
|
||||||
|
* The s32s are the mouse wheel.
|
||||||
|
*/
|
||||||
|
using MouseDevice = InputDevice<std::tuple<float, float, s32, s32>>;
|
||||||
|
|
||||||
} // namespace Input
|
} // namespace Input
|
||||||
|
|
|
@ -111,6 +111,30 @@ static const std::array<const char*, NumAnalogs> mapping = {{
|
||||||
}};
|
}};
|
||||||
} // namespace NativeAnalog
|
} // namespace NativeAnalog
|
||||||
|
|
||||||
|
namespace NativeMouseButton {
|
||||||
|
enum Values {
|
||||||
|
Left,
|
||||||
|
Right,
|
||||||
|
Middle,
|
||||||
|
Forward,
|
||||||
|
Back,
|
||||||
|
|
||||||
|
NumMouseButtons,
|
||||||
|
};
|
||||||
|
|
||||||
|
constexpr int MOUSE_HID_BEGIN = Left;
|
||||||
|
constexpr int MOUSE_HID_END = NumMouseButtons;
|
||||||
|
constexpr int NUM_MOUSE_HID = NumMouseButtons;
|
||||||
|
|
||||||
|
static const std::array<const char*, NumMouseButtons> mapping = {{
|
||||||
|
"left",
|
||||||
|
"right",
|
||||||
|
"middle",
|
||||||
|
"forward",
|
||||||
|
"back",
|
||||||
|
}};
|
||||||
|
} // namespace NativeMouseButton
|
||||||
|
|
||||||
struct Values {
|
struct Values {
|
||||||
// System
|
// System
|
||||||
bool use_docked_mode;
|
bool use_docked_mode;
|
||||||
|
@ -122,6 +146,9 @@ struct Values {
|
||||||
// Controls
|
// Controls
|
||||||
std::array<std::string, NativeButton::NumButtons> buttons;
|
std::array<std::string, NativeButton::NumButtons> buttons;
|
||||||
std::array<std::string, NativeAnalog::NumAnalogs> analogs;
|
std::array<std::string, NativeAnalog::NumAnalogs> analogs;
|
||||||
|
bool mouse_enabled;
|
||||||
|
std::string mouse_device;
|
||||||
|
MouseButtonsRaw mouse_buttons;
|
||||||
std::string motion_device;
|
std::string motion_device;
|
||||||
std::string touch_device;
|
std::string touch_device;
|
||||||
std::atomic_bool is_device_reload_pending{true};
|
std::atomic_bool is_device_reload_pending{true};
|
||||||
|
|
Reference in New Issue