diff options
| author | 2021-12-14 19:10:39 -0600 | |
|---|---|---|
| committer | 2021-12-14 19:10:39 -0600 | |
| commit | 5e732e7aecc38e863674120ee28842a719f35896 (patch) | |
| tree | 917f7c75447bc11f36778d1af4fced7e8fcef80c /src/common | |
| parent | Merge pull request #7577 from v1993/patch-2 (diff) | |
| parent | common/input: Avoid numerous large copies of CallbackStatus (diff) | |
| download | yuzu-5e732e7aecc38e863674120ee28842a719f35896.tar.gz yuzu-5e732e7aecc38e863674120ee28842a719f35896.tar.xz yuzu-5e732e7aecc38e863674120ee28842a719f35896.zip | |
Merge pull request #7581 from lioncash/input-iface
common/input: Avoid numerous large copies of CallbackStatus
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/input.h | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/common/input.h b/src/common/input.h index 0b92449bc..f775a4c01 100644 --- a/src/common/input.h +++ b/src/common/input.h | |||
| @@ -227,7 +227,7 @@ struct CallbackStatus { | |||
| 227 | 227 | ||
| 228 | // Triggered once every input change | 228 | // Triggered once every input change |
| 229 | struct InputCallback { | 229 | struct InputCallback { |
| 230 | std::function<void(CallbackStatus)> on_change; | 230 | std::function<void(const CallbackStatus&)> on_change; |
| 231 | }; | 231 | }; |
| 232 | 232 | ||
| 233 | /// An abstract class template for an input device (a button, an analog input, etc.). | 233 | /// An abstract class template for an input device (a button, an analog input, etc.). |
| @@ -236,14 +236,10 @@ public: | |||
| 236 | virtual ~InputDevice() = default; | 236 | virtual ~InputDevice() = default; |
| 237 | 237 | ||
| 238 | // Request input device to update if necessary | 238 | // Request input device to update if necessary |
| 239 | virtual void SoftUpdate() { | 239 | virtual void SoftUpdate() {} |
| 240 | return; | ||
| 241 | } | ||
| 242 | 240 | ||
| 243 | // Force input device to update data regardless of the current state | 241 | // Force input device to update data regardless of the current state |
| 244 | virtual void ForceUpdate() { | 242 | virtual void ForceUpdate() {} |
| 245 | return; | ||
| 246 | } | ||
| 247 | 243 | ||
| 248 | // Sets the function to be triggered when input changes | 244 | // Sets the function to be triggered when input changes |
| 249 | void SetCallback(InputCallback callback_) { | 245 | void SetCallback(InputCallback callback_) { |
| @@ -251,7 +247,7 @@ public: | |||
| 251 | } | 247 | } |
| 252 | 248 | ||
| 253 | // Triggers the function set in the callback | 249 | // Triggers the function set in the callback |
| 254 | void TriggerOnChange(CallbackStatus status) { | 250 | void TriggerOnChange(const CallbackStatus& status) { |
| 255 | if (callback.on_change) { | 251 | if (callback.on_change) { |
| 256 | callback.on_change(status); | 252 | callback.on_change(status); |
| 257 | } | 253 | } |