summaryrefslogtreecommitdiffstats
path: root/src/input_common/keyboard.cpp
diff options
context:
space:
mode:
authorwwylele <wwylele@gmail.com>2017-03-17 20:41:25 +0100
committerwwylele <wwylele@gmail.com>2017-03-17 20:41:25 +0100
commit5245c86f2662caa0e1e4b20508608b11237993b3 (patch)
tree5e489260c666bf8f09891e7678bfa5661dfd1c8c /src/input_common/keyboard.cpp
parentMerge pull request #2497 from wwylele/input-2 (diff)
downloadyuzu-5245c86f2662caa0e1e4b20508608b11237993b3.tar
yuzu-5245c86f2662caa0e1e4b20508608b11237993b3.tar.gz
yuzu-5245c86f2662caa0e1e4b20508608b11237993b3.tar.bz2
yuzu-5245c86f2662caa0e1e4b20508608b11237993b3.tar.lz
yuzu-5245c86f2662caa0e1e4b20508608b11237993b3.tar.xz
yuzu-5245c86f2662caa0e1e4b20508608b11237993b3.tar.zst
yuzu-5245c86f2662caa0e1e4b20508608b11237993b3.zip
Diffstat (limited to '')
-rw-r--r--src/input_common/keyboard.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/input_common/keyboard.cpp b/src/input_common/keyboard.cpp
index a8fc01f2e..0f0d10f23 100644
--- a/src/input_common/keyboard.cpp
+++ b/src/input_common/keyboard.cpp
@@ -53,6 +53,13 @@ public:
}
}
+ void ChangeAllKeyStatus(bool pressed) {
+ std::lock_guard<std::mutex> guard(mutex);
+ for (const KeyButtonPair& pair : list) {
+ pair.key_button->status.store(pressed);
+ }
+ }
+
private:
std::mutex mutex;
std::list<KeyButtonPair> list;
@@ -79,4 +86,8 @@ void Keyboard::ReleaseKey(int key_code) {
key_button_list->ChangeKeyStatus(key_code, false);
}
+void Keyboard::ReleaseAllKeys() {
+ key_button_list->ChangeAllKeyStatus(false);
+}
+
} // namespace InputCommon