diff options
Diffstat (limited to 'src/input_common/input_poller.h')
| -rw-r--r-- | src/input_common/input_poller.h | 212 |
1 files changed, 106 insertions, 106 deletions
diff --git a/src/input_common/input_poller.h b/src/input_common/input_poller.h index 573f09fde..8a0977d58 100644 --- a/src/input_common/input_poller.h +++ b/src/input_common/input_poller.h | |||
| @@ -13,9 +13,6 @@ class Factory; | |||
| 13 | 13 | ||
| 14 | namespace InputCommon { | 14 | namespace InputCommon { |
| 15 | class InputEngine; | 15 | class InputEngine; |
| 16 | /** | ||
| 17 | * An Input factory. It receives input events and forward them to all input devices it created. | ||
| 18 | */ | ||
| 19 | 16 | ||
| 20 | class OutputFactory final : public Common::Input::Factory<Common::Input::OutputDevice> { | 17 | class OutputFactory final : public Common::Input::Factory<Common::Input::OutputDevice> { |
| 21 | public: | 18 | public: |
| @@ -24,10 +21,10 @@ public: | |||
| 24 | /** | 21 | /** |
| 25 | * Creates an output device from the parameters given. | 22 | * Creates an output device from the parameters given. |
| 26 | * @param params contains parameters for creating the device: | 23 | * @param params contains parameters for creating the device: |
| 27 | * @param - "guid": text string for identifing controllers | 24 | * - "guid" text string for identifying controllers |
| 28 | * @param - "port": port of the connected device | 25 | * - "port": port of the connected device |
| 29 | * @param - "pad": slot of the connected controller | 26 | * - "pad": slot of the connected controller |
| 30 | * @return an unique ouput device with the parameters specified | 27 | * @returns a unique output device with the parameters specified |
| 31 | */ | 28 | */ |
| 32 | std::unique_ptr<Common::Input::OutputDevice> Create( | 29 | std::unique_ptr<Common::Input::OutputDevice> Create( |
| 33 | const Common::ParamPackage& params) override; | 30 | const Common::ParamPackage& params) override; |
| @@ -36,6 +33,9 @@ private: | |||
| 36 | std::shared_ptr<InputEngine> input_engine; | 33 | std::shared_ptr<InputEngine> input_engine; |
| 37 | }; | 34 | }; |
| 38 | 35 | ||
| 36 | /** | ||
| 37 | * An Input factory. It receives input events and forward them to all input devices it created. | ||
| 38 | */ | ||
| 39 | class InputFactory final : public Common::Input::Factory<Common::Input::InputDevice> { | 39 | class InputFactory final : public Common::Input::Factory<Common::Input::InputDevice> { |
| 40 | public: | 40 | public: |
| 41 | explicit InputFactory(std::shared_ptr<InputEngine> input_engine_); | 41 | explicit InputFactory(std::shared_ptr<InputEngine> input_engine_); |
| @@ -54,16 +54,16 @@ public: | |||
| 54 | * - battery: Contains "battery" | 54 | * - battery: Contains "battery" |
| 55 | * - output: Contains "output" | 55 | * - output: Contains "output" |
| 56 | * @param params contains parameters for creating the device: | 56 | * @param params contains parameters for creating the device: |
| 57 | * @param - "code": the code of the keyboard key to bind with the input | 57 | * - "code": the code of the keyboard key to bind with the input |
| 58 | * @param - "button": same as "code" but for controller buttons | 58 | * - "button": same as "code" but for controller buttons |
| 59 | * @param - "hat": similar as "button" but it's a group of hat buttons from SDL | 59 | * - "hat": similar as "button" but it's a group of hat buttons from SDL |
| 60 | * @param - "axis": the axis number of the axis to bind with the input | 60 | * - "axis": the axis number of the axis to bind with the input |
| 61 | * @param - "motion": the motion number of the motion to bind with the input | 61 | * - "motion": the motion number of the motion to bind with the input |
| 62 | * @param - "axis_x": same as axis but specifing horizontal direction | 62 | * - "axis_x": same as axis but specifying horizontal direction |
| 63 | * @param - "axis_y": same as axis but specifing vertical direction | 63 | * - "axis_y": same as axis but specifying vertical direction |
| 64 | * @param - "axis_z": same as axis but specifing forward direction | 64 | * - "axis_z": same as axis but specifying forward direction |
| 65 | * @param - "battery": Only used as a placeholder to set the input type | 65 | * - "battery": Only used as a placeholder to set the input type |
| 66 | * @return an unique input device with the parameters specified | 66 | * @returns a unique input device with the parameters specified |
| 67 | */ | 67 | */ |
| 68 | std::unique_ptr<Common::Input::InputDevice> Create(const Common::ParamPackage& params) override; | 68 | std::unique_ptr<Common::Input::InputDevice> Create(const Common::ParamPackage& params) override; |
| 69 | 69 | ||
| @@ -71,14 +71,14 @@ private: | |||
| 71 | /** | 71 | /** |
| 72 | * Creates a button device from the parameters given. | 72 | * Creates a button device from the parameters given. |
| 73 | * @param params contains parameters for creating the device: | 73 | * @param params contains parameters for creating the device: |
| 74 | * @param - "code": the code of the keyboard key to bind with the input | 74 | * - "code": the code of the keyboard key to bind with the input |
| 75 | * @param - "button": same as "code" but for controller buttons | 75 | * - "button": same as "code" but for controller buttons |
| 76 | * @param - "toggle": press once to enable, press again to disable | 76 | * - "toggle": press once to enable, press again to disable |
| 77 | * @param - "inverted": inverts the output of the button | 77 | * - "inverted": inverts the output of the button |
| 78 | * @param - "guid": text string for identifing controllers | 78 | * - "guid": text string for identifying controllers |
| 79 | * @param - "port": port of the connected device | 79 | * - "port": port of the connected device |
| 80 | * @param - "pad": slot of the connected controller | 80 | * - "pad": slot of the connected controller |
| 81 | * @return an unique input device with the parameters specified | 81 | * @returns a unique input device with the parameters specified |
| 82 | */ | 82 | */ |
| 83 | std::unique_ptr<Common::Input::InputDevice> CreateButtonDevice( | 83 | std::unique_ptr<Common::Input::InputDevice> CreateButtonDevice( |
| 84 | const Common::ParamPackage& params); | 84 | const Common::ParamPackage& params); |
| @@ -86,14 +86,14 @@ private: | |||
| 86 | /** | 86 | /** |
| 87 | * Creates a hat button device from the parameters given. | 87 | * Creates a hat button device from the parameters given. |
| 88 | * @param params contains parameters for creating the device: | 88 | * @param params contains parameters for creating the device: |
| 89 | * @param - "button": the controller hat id to bind with the input | 89 | * - "button": the controller hat id to bind with the input |
| 90 | * @param - "direction": the direction id to be detected | 90 | * - "direction": the direction id to be detected |
| 91 | * @param - "toggle": press once to enable, press again to disable | 91 | * - "toggle": press once to enable, press again to disable |
| 92 | * @param - "inverted": inverts the output of the button | 92 | * - "inverted": inverts the output of the button |
| 93 | * @param - "guid": text string for identifing controllers | 93 | * - "guid": text string for identifying controllers |
| 94 | * @param - "port": port of the connected device | 94 | * - "port": port of the connected device |
| 95 | * @param - "pad": slot of the connected controller | 95 | * - "pad": slot of the connected controller |
| 96 | * @return an unique input device with the parameters specified | 96 | * @returns a unique input device with the parameters specified |
| 97 | */ | 97 | */ |
| 98 | std::unique_ptr<Common::Input::InputDevice> CreateHatButtonDevice( | 98 | std::unique_ptr<Common::Input::InputDevice> CreateHatButtonDevice( |
| 99 | const Common::ParamPackage& params); | 99 | const Common::ParamPackage& params); |
| @@ -101,19 +101,19 @@ private: | |||
| 101 | /** | 101 | /** |
| 102 | * Creates a stick device from the parameters given. | 102 | * Creates a stick device from the parameters given. |
| 103 | * @param params contains parameters for creating the device: | 103 | * @param params contains parameters for creating the device: |
| 104 | * @param - "axis_x": the controller horizontal axis id to bind with the input | 104 | * - "axis_x": the controller horizontal axis id to bind with the input |
| 105 | * @param - "axis_y": the controller vertical axis id to bind with the input | 105 | * - "axis_y": the controller vertical axis id to bind with the input |
| 106 | * @param - "deadzone": the mimimum required value to be detected | 106 | * - "deadzone": the minimum required value to be detected |
| 107 | * @param - "range": the maximum value required to reach 100% | 107 | * - "range": the maximum value required to reach 100% |
| 108 | * @param - "threshold": the mimimum required value to considered pressed | 108 | * - "threshold": the minimum required value to considered pressed |
| 109 | * @param - "offset_x": the amount of offset in the x axis | 109 | * - "offset_x": the amount of offset in the x axis |
| 110 | * @param - "offset_y": the amount of offset in the y axis | 110 | * - "offset_y": the amount of offset in the y axis |
| 111 | * @param - "invert_x": inverts the sign of the horizontal axis | 111 | * - "invert_x": inverts the sign of the horizontal axis |
| 112 | * @param - "invert_y": inverts the sign of the vertical axis | 112 | * - "invert_y": inverts the sign of the vertical axis |
| 113 | * @param - "guid": text string for identifing controllers | 113 | * - "guid": text string for identifying controllers |
| 114 | * @param - "port": port of the connected device | 114 | * - "port": port of the connected device |
| 115 | * @param - "pad": slot of the connected controller | 115 | * - "pad": slot of the connected controller |
| 116 | * @return an unique input device with the parameters specified | 116 | * @returns a unique input device with the parameters specified |
| 117 | */ | 117 | */ |
| 118 | std::unique_ptr<Common::Input::InputDevice> CreateStickDevice( | 118 | std::unique_ptr<Common::Input::InputDevice> CreateStickDevice( |
| 119 | const Common::ParamPackage& params); | 119 | const Common::ParamPackage& params); |
| @@ -121,16 +121,16 @@ private: | |||
| 121 | /** | 121 | /** |
| 122 | * Creates an analog device from the parameters given. | 122 | * Creates an analog device from the parameters given. |
| 123 | * @param params contains parameters for creating the device: | 123 | * @param params contains parameters for creating the device: |
| 124 | * @param - "axis": the controller axis id to bind with the input | 124 | * - "axis": the controller axis id to bind with the input |
| 125 | * @param - "deadzone": the mimimum required value to be detected | 125 | * - "deadzone": the minimum required value to be detected |
| 126 | * @param - "range": the maximum value required to reach 100% | 126 | * - "range": the maximum value required to reach 100% |
| 127 | * @param - "threshold": the mimimum required value to considered pressed | 127 | * - "threshold": the minimum required value to considered pressed |
| 128 | * @param - "offset": the amount of offset in the axis | 128 | * - "offset": the amount of offset in the axis |
| 129 | * @param - "invert": inverts the sign of the axis | 129 | * - "invert": inverts the sign of the axis |
| 130 | * @param - "guid": text string for identifing controllers | 130 | * - "guid": text string for identifying controllers |
| 131 | * @param - "port": port of the connected device | 131 | * - "port": port of the connected device |
| 132 | * @param - "pad": slot of the connected controller | 132 | * - "pad": slot of the connected controller |
| 133 | * @return an unique input device with the parameters specified | 133 | * @returns a unique input device with the parameters specified |
| 134 | */ | 134 | */ |
| 135 | std::unique_ptr<Common::Input::InputDevice> CreateAnalogDevice( | 135 | std::unique_ptr<Common::Input::InputDevice> CreateAnalogDevice( |
| 136 | const Common::ParamPackage& params); | 136 | const Common::ParamPackage& params); |
| @@ -138,20 +138,20 @@ private: | |||
| 138 | /** | 138 | /** |
| 139 | * Creates a trigger device from the parameters given. | 139 | * Creates a trigger device from the parameters given. |
| 140 | * @param params contains parameters for creating the device: | 140 | * @param params contains parameters for creating the device: |
| 141 | * @param - "button": the controller hat id to bind with the input | 141 | * - "button": the controller hat id to bind with the input |
| 142 | * @param - "direction": the direction id to be detected | 142 | * - "direction": the direction id to be detected |
| 143 | * @param - "toggle": press once to enable, press again to disable | 143 | * - "toggle": press once to enable, press again to disable |
| 144 | * @param - "inverted": inverts the output of the button | 144 | * - "inverted": inverts the output of the button |
| 145 | * @param - "axis": the controller axis id to bind with the input | 145 | * - "axis": the controller axis id to bind with the input |
| 146 | * @param - "deadzone": the mimimum required value to be detected | 146 | * - "deadzone": the minimum required value to be detected |
| 147 | * @param - "range": the maximum value required to reach 100% | 147 | * - "range": the maximum value required to reach 100% |
| 148 | * @param - "threshold": the mimimum required value to considered pressed | 148 | * - "threshold": the minimum required value to considered pressed |
| 149 | * @param - "offset": the amount of offset in the axis | 149 | * - "offset": the amount of offset in the axis |
| 150 | * @param - "invert": inverts the sign of the axis | 150 | * - "invert": inverts the sign of the axis |
| 151 | * @param - "guid": text string for identifing controllers | 151 | * - "guid": text string for identifying controllers |
| 152 | * @param - "port": port of the connected device | 152 | * - "port": port of the connected device |
| 153 | * @param - "pad": slot of the connected controller | 153 | * - "pad": slot of the connected controller |
| 154 | * @return an unique input device with the parameters specified | 154 | * @returns a unique input device with the parameters specified |
| 155 | */ | 155 | */ |
| 156 | std::unique_ptr<Common::Input::InputDevice> CreateTriggerDevice( | 156 | std::unique_ptr<Common::Input::InputDevice> CreateTriggerDevice( |
| 157 | const Common::ParamPackage& params); | 157 | const Common::ParamPackage& params); |
| @@ -159,23 +159,23 @@ private: | |||
| 159 | /** | 159 | /** |
| 160 | * Creates a touch device from the parameters given. | 160 | * Creates a touch device from the parameters given. |
| 161 | * @param params contains parameters for creating the device: | 161 | * @param params contains parameters for creating the device: |
| 162 | * @param - "button": the controller hat id to bind with the input | 162 | * - "button": the controller hat id to bind with the input |
| 163 | * @param - "direction": the direction id to be detected | 163 | * - "direction": the direction id to be detected |
| 164 | * @param - "toggle": press once to enable, press again to disable | 164 | * - "toggle": press once to enable, press again to disable |
| 165 | * @param - "inverted": inverts the output of the button | 165 | * - "inverted": inverts the output of the button |
| 166 | * @param - "axis_x": the controller horizontal axis id to bind with the input | 166 | * - "axis_x": the controller horizontal axis id to bind with the input |
| 167 | * @param - "axis_y": the controller vertical axis id to bind with the input | 167 | * - "axis_y": the controller vertical axis id to bind with the input |
| 168 | * @param - "deadzone": the mimimum required value to be detected | 168 | * - "deadzone": the minimum required value to be detected |
| 169 | * @param - "range": the maximum value required to reach 100% | 169 | * - "range": the maximum value required to reach 100% |
| 170 | * @param - "threshold": the mimimum required value to considered pressed | 170 | * - "threshold": the minimum required value to considered pressed |
| 171 | * @param - "offset_x": the amount of offset in the x axis | 171 | * - "offset_x": the amount of offset in the x axis |
| 172 | * @param - "offset_y": the amount of offset in the y axis | 172 | * - "offset_y": the amount of offset in the y axis |
| 173 | * @param - "invert_x": inverts the sign of the horizontal axis | 173 | * - "invert_x": inverts the sign of the horizontal axis |
| 174 | * @param - "invert_y": inverts the sign of the vertical axis | 174 | * - "invert_y": inverts the sign of the vertical axis |
| 175 | * @param - "guid": text string for identifing controllers | 175 | * - "guid": text string for identifying controllers |
| 176 | * @param - "port": port of the connected device | 176 | * - "port": port of the connected device |
| 177 | * @param - "pad": slot of the connected controller | 177 | * - "pad": slot of the connected controller |
| 178 | * @return an unique input device with the parameters specified | 178 | * @returns a unique input device with the parameters specified |
| 179 | */ | 179 | */ |
| 180 | std::unique_ptr<Common::Input::InputDevice> CreateTouchDevice( | 180 | std::unique_ptr<Common::Input::InputDevice> CreateTouchDevice( |
| 181 | const Common::ParamPackage& params); | 181 | const Common::ParamPackage& params); |
| @@ -183,10 +183,10 @@ private: | |||
| 183 | /** | 183 | /** |
| 184 | * Creates a battery device from the parameters given. | 184 | * Creates a battery device from the parameters given. |
| 185 | * @param params contains parameters for creating the device: | 185 | * @param params contains parameters for creating the device: |
| 186 | * @param - "guid": text string for identifing controllers | 186 | * - "guid": text string for identifying controllers |
| 187 | * @param - "port": port of the connected device | 187 | * - "port": port of the connected device |
| 188 | * @param - "pad": slot of the connected controller | 188 | * - "pad": slot of the connected controller |
| 189 | * @return an unique input device with the parameters specified | 189 | * @returns a unique input device with the parameters specified |
| 190 | */ | 190 | */ |
| 191 | std::unique_ptr<Common::Input::InputDevice> CreateBatteryDevice( | 191 | std::unique_ptr<Common::Input::InputDevice> CreateBatteryDevice( |
| 192 | const Common::ParamPackage& params); | 192 | const Common::ParamPackage& params); |
| @@ -194,21 +194,21 @@ private: | |||
| 194 | /** | 194 | /** |
| 195 | * Creates a motion device from the parameters given. | 195 | * Creates a motion device from the parameters given. |
| 196 | * @param params contains parameters for creating the device: | 196 | * @param params contains parameters for creating the device: |
| 197 | * @param - "axis_x": the controller horizontal axis id to bind with the input | 197 | * - "axis_x": the controller horizontal axis id to bind with the input |
| 198 | * @param - "axis_y": the controller vertical axis id to bind with the input | 198 | * - "axis_y": the controller vertical axis id to bind with the input |
| 199 | * @param - "axis_z": the controller fordward axis id to bind with the input | 199 | * - "axis_z": the controller forward axis id to bind with the input |
| 200 | * @param - "deadzone": the mimimum required value to be detected | 200 | * - "deadzone": the minimum required value to be detected |
| 201 | * @param - "range": the maximum value required to reach 100% | 201 | * - "range": the maximum value required to reach 100% |
| 202 | * @param - "offset_x": the amount of offset in the x axis | 202 | * - "offset_x": the amount of offset in the x axis |
| 203 | * @param - "offset_y": the amount of offset in the y axis | 203 | * - "offset_y": the amount of offset in the y axis |
| 204 | * @param - "offset_z": the amount of offset in the z axis | 204 | * - "offset_z": the amount of offset in the z axis |
| 205 | * @param - "invert_x": inverts the sign of the horizontal axis | 205 | * - "invert_x": inverts the sign of the horizontal axis |
| 206 | * @param - "invert_y": inverts the sign of the vertical axis | 206 | * - "invert_y": inverts the sign of the vertical axis |
| 207 | * @param - "invert_z": inverts the sign of the fordward axis | 207 | * - "invert_z": inverts the sign of the forward axis |
| 208 | * @param - "guid": text string for identifing controllers | 208 | * - "guid": text string for identifying controllers |
| 209 | * @param - "port": port of the connected device | 209 | * - "port": port of the connected device |
| 210 | * @param - "pad": slot of the connected controller | 210 | * - "pad": slot of the connected controller |
| 211 | * @return an unique input device with the parameters specified | 211 | * @returns a unique input device with the parameters specified |
| 212 | */ | 212 | */ |
| 213 | std::unique_ptr<Common::Input::InputDevice> CreateMotionDevice(Common::ParamPackage params); | 213 | std::unique_ptr<Common::Input::InputDevice> CreateMotionDevice(Common::ParamPackage params); |
| 214 | 214 | ||