diff options
| author | 2021-12-13 10:18:02 -0500 | |
|---|---|---|
| committer | 2021-12-13 10:18:04 -0500 | |
| commit | a9d39b68952bf3ce9607a5947f056eb990e2b430 (patch) | |
| tree | 03c083b4c17c1d8365177f73065c410207305222 /src/input_common/input_engine.h | |
| parent | input_engine: Avoid redundant map lookups (diff) | |
| download | yuzu-a9d39b68952bf3ce9607a5947f056eb990e2b430.tar.gz yuzu-a9d39b68952bf3ce9607a5947f056eb990e2b430.tar.xz yuzu-a9d39b68952bf3ce9607a5947f056eb990e2b430.zip | |
input_engine: Simplify PreSet* family of functions
We can make use of try_emplace() to insert values only if they don't
already exist.
Diffstat (limited to 'src/input_common/input_engine.h')
| -rw-r--r-- | src/input_common/input_engine.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/input_common/input_engine.h b/src/input_common/input_engine.h index 59707e173..ec8890484 100644 --- a/src/input_common/input_engine.h +++ b/src/input_common/input_engine.h | |||
| @@ -23,15 +23,15 @@ struct PadIdentifier { | |||
| 23 | friend constexpr bool operator==(const PadIdentifier&, const PadIdentifier&) = default; | 23 | friend constexpr bool operator==(const PadIdentifier&, const PadIdentifier&) = default; |
| 24 | }; | 24 | }; |
| 25 | 25 | ||
| 26 | // Basic motion data containing data from the sensors and a timestamp in microsecons | 26 | // Basic motion data containing data from the sensors and a timestamp in microseconds |
| 27 | struct BasicMotion { | 27 | struct BasicMotion { |
| 28 | float gyro_x; | 28 | float gyro_x{}; |
| 29 | float gyro_y; | 29 | float gyro_y{}; |
| 30 | float gyro_z; | 30 | float gyro_z{}; |
| 31 | float accel_x; | 31 | float accel_x{}; |
| 32 | float accel_y; | 32 | float accel_y{}; |
| 33 | float accel_z; | 33 | float accel_z{}; |
| 34 | u64 delta_timestamp; | 34 | u64 delta_timestamp{}; |
| 35 | }; | 35 | }; |
| 36 | 36 | ||
| 37 | // Stages of a battery charge | 37 | // Stages of a battery charge |
| @@ -202,7 +202,7 @@ private: | |||
| 202 | std::unordered_map<int, u8> hat_buttons; | 202 | std::unordered_map<int, u8> hat_buttons; |
| 203 | std::unordered_map<int, float> axes; | 203 | std::unordered_map<int, float> axes; |
| 204 | std::unordered_map<int, BasicMotion> motions; | 204 | std::unordered_map<int, BasicMotion> motions; |
| 205 | BatteryLevel battery; | 205 | BatteryLevel battery{}; |
| 206 | }; | 206 | }; |
| 207 | 207 | ||
| 208 | void TriggerOnButtonChange(const PadIdentifier& identifier, int button, bool value); | 208 | void TriggerOnButtonChange(const PadIdentifier& identifier, int button, bool value); |