summaryrefslogtreecommitdiffstats
path: root/src/common/input.h
diff options
context:
space:
mode:
authorNarr the Reg <juangerman-13@hotmail.com>2021-12-15 02:10:39 +0100
committerGitHub <noreply@github.com>2021-12-15 02:10:39 +0100
commit5e732e7aecc38e863674120ee28842a719f35896 (patch)
tree917f7c75447bc11f36778d1af4fced7e8fcef80c /src/common/input.h
parentMerge pull request #7577 from v1993/patch-2 (diff)
parentcommon/input: Avoid numerous large copies of CallbackStatus (diff)
downloadyuzu-5e732e7aecc38e863674120ee28842a719f35896.tar
yuzu-5e732e7aecc38e863674120ee28842a719f35896.tar.gz
yuzu-5e732e7aecc38e863674120ee28842a719f35896.tar.bz2
yuzu-5e732e7aecc38e863674120ee28842a719f35896.tar.lz
yuzu-5e732e7aecc38e863674120ee28842a719f35896.tar.xz
yuzu-5e732e7aecc38e863674120ee28842a719f35896.tar.zst
yuzu-5e732e7aecc38e863674120ee28842a719f35896.zip
Diffstat (limited to 'src/common/input.h')
-rw-r--r--src/common/input.h12
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 {
// Triggered once every input change
struct InputCallback {
- std::function<void(CallbackStatus)> on_change;
+ std::function<void(const CallbackStatus&)> on_change;
};
/// An abstract class template for an input device (a button, an analog input, etc.).
@@ -236,14 +236,10 @@ public:
virtual ~InputDevice() = default;
// Request input device to update if necessary
- virtual void SoftUpdate() {
- return;
- }
+ virtual void SoftUpdate() {}
// Force input device to update data regardless of the current state
- virtual void ForceUpdate() {
- return;
- }
+ virtual void ForceUpdate() {}
// Sets the function to be triggered when input changes
void SetCallback(InputCallback callback_) {
@@ -251,7 +247,7 @@ public:
}
// Triggers the function set in the callback
- void TriggerOnChange(CallbackStatus status) {
+ void TriggerOnChange(const CallbackStatus& status) {
if (callback.on_change) {
callback.on_change(status);
}