diff options
| author | 2016-09-21 11:29:48 -0700 | |
|---|---|---|
| committer | 2016-09-21 11:29:48 -0700 | |
| commit | d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a (patch) | |
| tree | 8a22ca73ff838f3f0090b29a548ae81087fc90ed /src/common/key_map.cpp | |
| parent | README: Specify master branch for Travis CI badge (diff) | |
| parent | Fix Travis clang-format check (diff) | |
| download | yuzu-d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a.tar.gz yuzu-d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a.tar.xz yuzu-d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a.zip | |
Merge pull request #2086 from linkmauve/clang-format
Add clang-format as part of our {commit,travis}-time checks
Diffstat (limited to 'src/common/key_map.cpp')
| -rw-r--r-- | src/common/key_map.cpp | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/src/common/key_map.cpp b/src/common/key_map.cpp index ad311d66b..79b3fcb18 100644 --- a/src/common/key_map.cpp +++ b/src/common/key_map.cpp | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <map> | 5 | #include <map> |
| 6 | |||
| 7 | #include "common/emu_window.h" | 6 | #include "common/emu_window.h" |
| 8 | #include "common/key_map.h" | 7 | #include "common/key_map.h" |
| 9 | 8 | ||
| @@ -13,11 +12,25 @@ namespace KeyMap { | |||
| 13 | // and map it directly to EmuWindow::ButtonPressed. | 12 | // and map it directly to EmuWindow::ButtonPressed. |
| 14 | // It should go the analog input way like circle pad does. | 13 | // It should go the analog input way like circle pad does. |
| 15 | const std::array<KeyTarget, Settings::NativeInput::NUM_INPUTS> mapping_targets = {{ | 14 | const std::array<KeyTarget, Settings::NativeInput::NUM_INPUTS> mapping_targets = {{ |
| 16 | Service::HID::PAD_A, Service::HID::PAD_B, Service::HID::PAD_X, Service::HID::PAD_Y, | 15 | Service::HID::PAD_A, |
| 17 | Service::HID::PAD_L, Service::HID::PAD_R, Service::HID::PAD_ZL, Service::HID::PAD_ZR, | 16 | Service::HID::PAD_B, |
| 18 | Service::HID::PAD_START, Service::HID::PAD_SELECT, Service::HID::PAD_NONE, | 17 | Service::HID::PAD_X, |
| 19 | Service::HID::PAD_UP, Service::HID::PAD_DOWN, Service::HID::PAD_LEFT, Service::HID::PAD_RIGHT, | 18 | Service::HID::PAD_Y, |
| 20 | Service::HID::PAD_C_UP, Service::HID::PAD_C_DOWN, Service::HID::PAD_C_LEFT, Service::HID::PAD_C_RIGHT, | 19 | Service::HID::PAD_L, |
| 20 | Service::HID::PAD_R, | ||
| 21 | Service::HID::PAD_ZL, | ||
| 22 | Service::HID::PAD_ZR, | ||
| 23 | Service::HID::PAD_START, | ||
| 24 | Service::HID::PAD_SELECT, | ||
| 25 | Service::HID::PAD_NONE, | ||
| 26 | Service::HID::PAD_UP, | ||
| 27 | Service::HID::PAD_DOWN, | ||
| 28 | Service::HID::PAD_LEFT, | ||
| 29 | Service::HID::PAD_RIGHT, | ||
| 30 | Service::HID::PAD_C_UP, | ||
| 31 | Service::HID::PAD_C_DOWN, | ||
| 32 | Service::HID::PAD_C_LEFT, | ||
| 33 | Service::HID::PAD_C_RIGHT, | ||
| 21 | 34 | ||
| 22 | IndirectTarget::CirclePadUp, | 35 | IndirectTarget::CirclePadUp, |
| 23 | IndirectTarget::CirclePadDown, | 36 | IndirectTarget::CirclePadDown, |
| @@ -49,7 +62,8 @@ static void UpdateCirclePad(EmuWindow& emu_window) { | |||
| 49 | --y; | 62 | --y; |
| 50 | 63 | ||
| 51 | float modifier = circle_pad_modifier ? Settings::values.pad_circle_modifier_scale : 1.0; | 64 | float modifier = circle_pad_modifier ? Settings::values.pad_circle_modifier_scale : 1.0; |
| 52 | emu_window.CirclePadUpdated(x * modifier * (y == 0 ? 1.0 : SQRT_HALF), y * modifier * (x == 0 ? 1.0 : SQRT_HALF)); | 65 | emu_window.CirclePadUpdated(x * modifier * (y == 0 ? 1.0 : SQRT_HALF), |
| 66 | y * modifier * (x == 0 ? 1.0 : SQRT_HALF)); | ||
| 53 | } | 67 | } |
| 54 | 68 | ||
| 55 | int NewDeviceId() { | 69 | int NewDeviceId() { |
| @@ -103,7 +117,7 @@ void PressKey(EmuWindow& emu_window, HostDeviceKey key) { | |||
| 103 | } | 117 | } |
| 104 | } | 118 | } |
| 105 | 119 | ||
| 106 | void ReleaseKey(EmuWindow& emu_window,HostDeviceKey key) { | 120 | void ReleaseKey(EmuWindow& emu_window, HostDeviceKey key) { |
| 107 | auto target = key_map.find(key); | 121 | auto target = key_map.find(key); |
| 108 | if (target == key_map.end()) | 122 | if (target == key_map.end()) |
| 109 | return; | 123 | return; |
| @@ -135,5 +149,4 @@ void ReleaseKey(EmuWindow& emu_window,HostDeviceKey key) { | |||
| 135 | } | 149 | } |
| 136 | } | 150 | } |
| 137 | } | 151 | } |
| 138 | |||
| 139 | } | 152 | } |