diff options
Diffstat (limited to 'src/input_common/gcadapter/gc_poller.h')
| -rw-r--r-- | src/input_common/gcadapter/gc_poller.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/input_common/gcadapter/gc_poller.h b/src/input_common/gcadapter/gc_poller.h new file mode 100644 index 000000000..d115b1d2a --- /dev/null +++ b/src/input_common/gcadapter/gc_poller.h | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <memory> | ||
| 4 | #include "core/frontend/input.h" | ||
| 5 | |||
| 6 | namespace InputCommon { | ||
| 7 | |||
| 8 | |||
| 9 | /** | ||
| 10 | * A button device factory representing a gcpad. It receives gcpad events and forward them | ||
| 11 | * to all button devices it created. | ||
| 12 | */ | ||
| 13 | class GCButtonFactory final : public Input::Factory<Input::ButtonDevice> { | ||
| 14 | public: | ||
| 15 | GCButtonFactory(); | ||
| 16 | |||
| 17 | /** | ||
| 18 | * Creates a button device from a button press | ||
| 19 | * @param params contains parameters for creating the device: | ||
| 20 | * - "code": the code of the key to bind with the button | ||
| 21 | */ | ||
| 22 | std::unique_ptr<Input::ButtonDevice> Create(const Common::ParamPackage& params) override; | ||
| 23 | |||
| 24 | Common::ParamPackage GetNextInput(); | ||
| 25 | |||
| 26 | /// For device input configuration/polling | ||
| 27 | void BeginConfiguration(); | ||
| 28 | void EndConfiguration(); | ||
| 29 | |||
| 30 | bool IsPolling() { | ||
| 31 | return polling; | ||
| 32 | } | ||
| 33 | |||
| 34 | private: | ||
| 35 | bool polling = false; | ||
| 36 | }; | ||
| 37 | |||
| 38 | /// An analog device factory that creates analog devices from GC Adapter | ||
| 39 | class GCAnalogFactory final : public Input::Factory<Input::AnalogDevice> { | ||
| 40 | public: | ||
| 41 | GCAnalogFactory(); | ||
| 42 | std::unique_ptr<Input::AnalogDevice> Create(const Common::ParamPackage& params) override; | ||
| 43 | Common::ParamPackage GetNextInput(); | ||
| 44 | |||
| 45 | /// For device input configuration/polling | ||
| 46 | void BeginConfiguration(); | ||
| 47 | void EndConfiguration(); | ||
| 48 | |||
| 49 | bool IsPolling() { | ||
| 50 | return polling; | ||
| 51 | } | ||
| 52 | |||
| 53 | private: | ||
| 54 | int analog_x_axis = -1; | ||
| 55 | int analog_y_axis = -1; | ||
| 56 | int controller_number = -1; | ||
| 57 | bool polling = false; | ||
| 58 | }; | ||
| 59 | } // namespace InputCommon | ||