diff options
author | wwylele <wwylele@gmail.com> | 2017-01-21 12:04:00 +0100 |
---|---|---|
committer | wwylele <wwylele@gmail.com> | 2017-03-01 22:30:57 +0100 |
commit | a6bd7917cbc06f9b8f5a7ae24e75db776dc1cd6a (patch) | |
tree | 2ed60e602d520f80f57f88f879c4f50363432c17 /src/input_common/main.cpp | |
parent | InputCommon: add Keyboard (diff) | |
download | yuzu-a6bd7917cbc06f9b8f5a7ae24e75db776dc1cd6a.tar yuzu-a6bd7917cbc06f9b8f5a7ae24e75db776dc1cd6a.tar.gz yuzu-a6bd7917cbc06f9b8f5a7ae24e75db776dc1cd6a.tar.bz2 yuzu-a6bd7917cbc06f9b8f5a7ae24e75db776dc1cd6a.tar.lz yuzu-a6bd7917cbc06f9b8f5a7ae24e75db776dc1cd6a.tar.xz yuzu-a6bd7917cbc06f9b8f5a7ae24e75db776dc1cd6a.tar.zst yuzu-a6bd7917cbc06f9b8f5a7ae24e75db776dc1cd6a.zip |
Diffstat (limited to 'src/input_common/main.cpp')
-rw-r--r-- | src/input_common/main.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp index ff25220b4..8455fdc17 100644 --- a/src/input_common/main.cpp +++ b/src/input_common/main.cpp @@ -4,6 +4,7 @@ #include <memory> #include "common/param_package.h" +#include "input_common/analog_from_button.h" #include "input_common/keyboard.h" #include "input_common/main.h" @@ -14,11 +15,14 @@ static std::shared_ptr<Keyboard> keyboard; void Init() { keyboard = std::make_shared<InputCommon::Keyboard>(); Input::RegisterFactory<Input::ButtonDevice>("keyboard", keyboard); + Input::RegisterFactory<Input::AnalogDevice>("analog_from_button", + std::make_shared<InputCommon::AnalogFromButton>()); } void Shutdown() { Input::UnregisterFactory<Input::ButtonDevice>("keyboard"); keyboard.reset(); + Input::UnregisterFactory<Input::AnalogDevice>("analog_from_button"); } Keyboard* GetKeyboard() { @@ -32,4 +36,18 @@ std::string GenerateKeyboardParam(int key_code) { return param.Serialize(); } +std::string GenerateAnalogParamFromKeys(int key_up, int key_down, int key_left, int key_right, + int key_modifier, float modifier_scale) { + Common::ParamPackage circle_pad_param{ + {"engine", "analog_from_button"}, + {"up", GenerateKeyboardParam(key_up)}, + {"down", GenerateKeyboardParam(key_down)}, + {"left", GenerateKeyboardParam(key_left)}, + {"right", GenerateKeyboardParam(key_right)}, + {"modifier", GenerateKeyboardParam(key_modifier)}, + {"modifier_scale", std::to_string(modifier_scale)}, + }; + return circle_pad_param.Serialize(); +} + } // namespace InputCommon |