diff options
| author | 2017-12-06 05:26:29 +0100 | |
|---|---|---|
| committer | 2018-01-15 20:02:30 -0500 | |
| commit | eaff98dbb3da3c7524a504abb1cdd5daa3480dda (patch) | |
| tree | 4e5d28ed590b01d001c065e6ac08f2df6daabf75 /src/input_common/main.h | |
| parent | pctl: Clang format. (diff) | |
| download | yuzu-eaff98dbb3da3c7524a504abb1cdd5daa3480dda.tar.gz yuzu-eaff98dbb3da3c7524a504abb1cdd5daa3480dda.tar.xz yuzu-eaff98dbb3da3c7524a504abb1cdd5daa3480dda.zip | |
Adding meumart's Citra SDL Joystick support. Citra PR #3116
Diffstat (limited to 'src/input_common/main.h')
| -rw-r--r-- | src/input_common/main.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/input_common/main.h b/src/input_common/main.h index 5604f0fa8..77a0ce90b 100644 --- a/src/input_common/main.h +++ b/src/input_common/main.h | |||
| @@ -4,7 +4,13 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <memory> | ||
| 7 | #include <string> | 8 | #include <string> |
| 9 | #include <vector> | ||
| 10 | |||
| 11 | namespace Common { | ||
| 12 | class ParamPackage; | ||
| 13 | } | ||
| 8 | 14 | ||
| 9 | namespace InputCommon { | 15 | namespace InputCommon { |
| 10 | 16 | ||
| @@ -31,4 +37,30 @@ std::string GenerateKeyboardParam(int key_code); | |||
| 31 | std::string GenerateAnalogParamFromKeys(int key_up, int key_down, int key_left, int key_right, | 37 | std::string GenerateAnalogParamFromKeys(int key_up, int key_down, int key_left, int key_right, |
| 32 | int key_modifier, float modifier_scale); | 38 | int key_modifier, float modifier_scale); |
| 33 | 39 | ||
| 40 | namespace Polling { | ||
| 41 | |||
| 42 | enum class DeviceType { Button, Analog }; | ||
| 43 | |||
| 44 | /** | ||
| 45 | * A class that can be used to get inputs from an input device like controllers without having to | ||
| 46 | * poll the device's status yourself | ||
| 47 | */ | ||
| 48 | class DevicePoller { | ||
| 49 | public: | ||
| 50 | virtual ~DevicePoller() = default; | ||
| 51 | /// Setup and start polling for inputs, should be called before GetNextInput | ||
| 52 | virtual void Start() = 0; | ||
| 53 | /// Stop polling | ||
| 54 | virtual void Stop() = 0; | ||
| 55 | /** | ||
| 56 | * Every call to this function returns the next input recorded since calling Start | ||
| 57 | * @return A ParamPackage of the recorded input, which can be used to create an InputDevice. | ||
| 58 | * If there has been no input, the package is empty | ||
| 59 | */ | ||
| 60 | virtual Common::ParamPackage GetNextInput() = 0; | ||
| 61 | }; | ||
| 62 | |||
| 63 | // Get all DevicePoller from all backends for a specific device type | ||
| 64 | std::vector<std::unique_ptr<DevicePoller>> GetPollers(DeviceType type); | ||
| 65 | } // namespace Polling | ||
| 34 | } // namespace InputCommon | 66 | } // namespace InputCommon |