diff options
| author | 2017-01-21 11:53:03 +0200 | |
|---|---|---|
| committer | 2017-03-01 23:30:57 +0200 | |
| commit | 38e800f70d122051e12ac9f22e23d84b97fec424 (patch) | |
| tree | 0f52b5731a4fd8e9f2a39e8e75d1fa18ce8b9107 /src/input_common/main.cpp | |
| parent | HID: use AnalogDevice (diff) | |
| download | yuzu-38e800f70d122051e12ac9f22e23d84b97fec424.tar.gz yuzu-38e800f70d122051e12ac9f22e23d84b97fec424.tar.xz yuzu-38e800f70d122051e12ac9f22e23d84b97fec424.zip | |
InputCommon: add Keyboard
Diffstat (limited to 'src/input_common/main.cpp')
| -rw-r--r-- | src/input_common/main.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp new file mode 100644 index 000000000..ff25220b4 --- /dev/null +++ b/src/input_common/main.cpp | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | // Copyright 2017 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include <memory> | ||
| 6 | #include "common/param_package.h" | ||
| 7 | #include "input_common/keyboard.h" | ||
| 8 | #include "input_common/main.h" | ||
| 9 | |||
| 10 | namespace InputCommon { | ||
| 11 | |||
| 12 | static std::shared_ptr<Keyboard> keyboard; | ||
| 13 | |||
| 14 | void Init() { | ||
| 15 | keyboard = std::make_shared<InputCommon::Keyboard>(); | ||
| 16 | Input::RegisterFactory<Input::ButtonDevice>("keyboard", keyboard); | ||
| 17 | } | ||
| 18 | |||
| 19 | void Shutdown() { | ||
| 20 | Input::UnregisterFactory<Input::ButtonDevice>("keyboard"); | ||
| 21 | keyboard.reset(); | ||
| 22 | } | ||
| 23 | |||
| 24 | Keyboard* GetKeyboard() { | ||
| 25 | return keyboard.get(); | ||
| 26 | } | ||
| 27 | |||
| 28 | std::string GenerateKeyboardParam(int key_code) { | ||
| 29 | Common::ParamPackage param{ | ||
| 30 | {"engine", "keyboard"}, {"code", std::to_string(key_code)}, | ||
| 31 | }; | ||
| 32 | return param.Serialize(); | ||
| 33 | } | ||
| 34 | |||
| 35 | } // namespace InputCommon | ||