diff options
| author | 2018-11-01 21:52:51 -0400 | |
|---|---|---|
| committer | 2018-11-18 23:21:33 -0500 | |
| commit | 152422bab1382575e951c1c11b5de3013b8b402a (patch) | |
| tree | 4570cf52793caa2bd7bf1971f2c7dd945889112d /src | |
| parent | Added missing start/end touch attributes to touchscreen (diff) | |
| download | yuzu-152422bab1382575e951c1c11b5de3013b8b402a.tar.gz yuzu-152422bab1382575e951c1c11b5de3013b8b402a.tar.xz yuzu-152422bab1382575e951c1c11b5de3013b8b402a.zip | |
settings: Add Native type for mouse buttons
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/frontend/input.h | 7 | ||||
| -rw-r--r-- | src/core/settings.h | 27 |
2 files changed, 34 insertions, 0 deletions
diff --git a/src/core/frontend/input.h b/src/core/frontend/input.h index 39bdf4e21..16fdcd376 100644 --- a/src/core/frontend/input.h +++ b/src/core/frontend/input.h | |||
| @@ -132,4 +132,11 @@ using MotionDevice = InputDevice<std::tuple<Math::Vec3<float>, Math::Vec3<float> | |||
| 132 | */ | 132 | */ |
| 133 | using TouchDevice = InputDevice<std::tuple<float, float, bool>>; | 133 | using TouchDevice = InputDevice<std::tuple<float, float, bool>>; |
| 134 | 134 | ||
| 135 | /** | ||
| 136 | * A mouse device is an input device that returns a tuple of two floats and four ints. | ||
| 137 | * The first two floats are X and Y device coordinates of the mouse (from 0-1). | ||
| 138 | * The s32s are the mouse wheel. | ||
| 139 | */ | ||
| 140 | using MouseDevice = InputDevice<std::tuple<float, float, s32, s32>>; | ||
| 141 | |||
| 135 | } // namespace Input | 142 | } // namespace Input |
diff --git a/src/core/settings.h b/src/core/settings.h index e424479f2..d9aa14cd2 100644 --- a/src/core/settings.h +++ b/src/core/settings.h | |||
| @@ -111,6 +111,30 @@ static const std::array<const char*, NumAnalogs> mapping = {{ | |||
| 111 | }}; | 111 | }}; |
| 112 | } // namespace NativeAnalog | 112 | } // namespace NativeAnalog |
| 113 | 113 | ||
| 114 | namespace NativeMouseButton { | ||
| 115 | enum Values { | ||
| 116 | Left, | ||
| 117 | Right, | ||
| 118 | Middle, | ||
| 119 | Forward, | ||
| 120 | Back, | ||
| 121 | |||
| 122 | NumMouseButtons, | ||
| 123 | }; | ||
| 124 | |||
| 125 | constexpr int MOUSE_HID_BEGIN = Left; | ||
| 126 | constexpr int MOUSE_HID_END = NumMouseButtons; | ||
| 127 | constexpr int NUM_MOUSE_HID = NumMouseButtons; | ||
| 128 | |||
| 129 | static const std::array<const char*, NumMouseButtons> mapping = {{ | ||
| 130 | "left", | ||
| 131 | "right", | ||
| 132 | "middle", | ||
| 133 | "forward", | ||
| 134 | "back", | ||
| 135 | }}; | ||
| 136 | } // namespace NativeMouseButton | ||
| 137 | |||
| 114 | struct Values { | 138 | struct Values { |
| 115 | // System | 139 | // System |
| 116 | bool use_docked_mode; | 140 | bool use_docked_mode; |
| @@ -122,6 +146,9 @@ struct Values { | |||
| 122 | // Controls | 146 | // Controls |
| 123 | std::array<std::string, NativeButton::NumButtons> buttons; | 147 | std::array<std::string, NativeButton::NumButtons> buttons; |
| 124 | std::array<std::string, NativeAnalog::NumAnalogs> analogs; | 148 | std::array<std::string, NativeAnalog::NumAnalogs> analogs; |
| 149 | bool mouse_enabled; | ||
| 150 | std::string mouse_device; | ||
| 151 | MouseButtonsRaw mouse_buttons; | ||
| 125 | std::string motion_device; | 152 | std::string motion_device; |
| 126 | std::string touch_device; | 153 | std::string touch_device; |
| 127 | std::atomic_bool is_device_reload_pending{true}; | 154 | std::atomic_bool is_device_reload_pending{true}; |