summaryrefslogtreecommitdiff
path: root/src/input_common/drivers/keyboard.cpp
diff options
context:
space:
mode:
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