summaryrefslogtreecommitdiff
path: root/src/input_common/drivers/keyboard.cpp
diff options
context:
space:
mode:
authorGravatar german772021-09-20 17:18:40 -0500
committerGravatar Narr the Reg2021-11-24 20:30:22 -0600
commit5a785ed794fff8c944283271bf25cb835c11700a (patch)
treedc99f3fb595a57e9629661d3002dad724914275b /src/input_common/drivers/keyboard.cpp
parentinput_common: Move touch and analog from button. Move udp protocol (diff)
downloadyuzu-5a785ed794fff8c944283271bf25cb835c11700a.tar.gz
yuzu-5a785ed794fff8c944283271bf25cb835c11700a.tar.xz
yuzu-5a785ed794fff8c944283271bf25cb835c11700a.zip
input_common: Rewrite keyboard
Diffstat (limited to 'src/input_common/drivers/keyboard.cpp')
-rw-r--r--src/input_common/drivers/keyboard.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/input_common/drivers/keyboard.cpp b/src/input_common/drivers/keyboard.cpp
new file mode 100644
index 000000000..b00a4b8d9
--- /dev/null
+++ b/src/input_common/drivers/keyboard.cpp
@@ -0,0 +1,35 @@
1// Copyright 2021 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included
4
5#include "common/param_package.h"
6#include "input_common/drivers/keyboard.h"
7
8namespace InputCommon {
9
10Keyboard::Keyboard(const std::string& input_engine_) : InputEngine(input_engine_) {
11 PreSetController(identifier);
12}
13
14void Keyboard::PressKey(int key_code) {
15 SetButton(identifier, key_code, true);
16}
17
18void Keyboard::ReleaseKey(int key_code) {
19 SetButton(identifier, key_code, false);
20}
21
22void Keyboard::ReleaseAllKeys() {
23 ResetButtonState();
24}
25
26std::vector<Common::ParamPackage> Keyboard::GetInputDevices() const {
27 std::vector<Common::ParamPackage> devices;
28 devices.emplace_back(Common::ParamPackage{
29 {"engine", "keyboard"},
30 {"display", "Keyboard Only"},
31 });
32 return devices;
33}
34
35} // namespace InputCommon