summaryrefslogtreecommitdiff
path: root/src/input_common/input_engine.h
diff options
context:
space:
mode:
authorGravatar german772022-06-18 23:32:07 -0500
committerGravatar german772022-07-23 19:38:42 -0500
commitf19e7be6e84357234c9fdae3395f988a9bb1ac5b (patch)
treecc93872ac739fd7b967f8f62ea6abf2c8639221d /src/input_common/input_engine.h
parentMerge pull request #8545 from Kelebek1/Audio (diff)
downloadyuzu-f19e7be6e84357234c9fdae3395f988a9bb1ac5b.tar.gz
yuzu-f19e7be6e84357234c9fdae3395f988a9bb1ac5b.tar.xz
yuzu-f19e7be6e84357234c9fdae3395f988a9bb1ac5b.zip
input_common: Add camera driver
Diffstat (limited to 'src/input_common/input_engine.h')
-rw-r--r--src/input_common/input_engine.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/input_common/input_engine.h b/src/input_common/input_engine.h
index 13295bd49..f6b3c4610 100644
--- a/src/input_common/input_engine.h
+++ b/src/input_common/input_engine.h
@@ -36,11 +36,12 @@ struct BasicMotion {
36// Types of input that are stored in the engine 36// Types of input that are stored in the engine
37enum class EngineInputType { 37enum class EngineInputType {
38 None, 38 None,
39 Analog,
40 Battery,
39 Button, 41 Button,
42 Camera,
40 HatButton, 43 HatButton,
41 Analog,
42 Motion, 44 Motion,
43 Battery,
44}; 45};
45 46
46namespace std { 47namespace std {
@@ -115,10 +116,17 @@ public:
115 // Sets polling mode to a controller 116 // Sets polling mode to a controller
116 virtual Common::Input::PollingError SetPollingMode( 117 virtual Common::Input::PollingError SetPollingMode(
117 [[maybe_unused]] const PadIdentifier& identifier, 118 [[maybe_unused]] const PadIdentifier& identifier,
118 [[maybe_unused]] const Common::Input::PollingMode vibration) { 119 [[maybe_unused]] const Common::Input::PollingMode polling_mode) {
119 return Common::Input::PollingError::NotSupported; 120 return Common::Input::PollingError::NotSupported;
120 } 121 }
121 122
123 // Sets camera format to a controller
124 virtual Common::Input::CameraError SetCameraFormat(
125 [[maybe_unused]] const PadIdentifier& identifier,
126 [[maybe_unused]] Common::Input::CameraFormat camera_format) {
127 return Common::Input::CameraError::NotSupported;
128 }
129
122 // Returns the engine name 130 // Returns the engine name
123 [[nodiscard]] const std::string& GetEngineName() const; 131 [[nodiscard]] const std::string& GetEngineName() const;
124 132
@@ -174,6 +182,7 @@ public:
174 f32 GetAxis(const PadIdentifier& identifier, int axis) const; 182 f32 GetAxis(const PadIdentifier& identifier, int axis) const;
175 Common::Input::BatteryLevel GetBattery(const PadIdentifier& identifier) const; 183 Common::Input::BatteryLevel GetBattery(const PadIdentifier& identifier) const;
176 BasicMotion GetMotion(const PadIdentifier& identifier, int motion) const; 184 BasicMotion GetMotion(const PadIdentifier& identifier, int motion) const;
185 Common::Input::CameraStatus GetCamera(const PadIdentifier& identifier) const;
177 186
178 int SetCallback(InputIdentifier input_identifier); 187 int SetCallback(InputIdentifier input_identifier);
179 void SetMappingCallback(MappingCallback callback); 188 void SetMappingCallback(MappingCallback callback);
@@ -185,6 +194,7 @@ protected:
185 void SetAxis(const PadIdentifier& identifier, int axis, f32 value); 194 void SetAxis(const PadIdentifier& identifier, int axis, f32 value);
186 void SetBattery(const PadIdentifier& identifier, Common::Input::BatteryLevel value); 195 void SetBattery(const PadIdentifier& identifier, Common::Input::BatteryLevel value);
187 void SetMotion(const PadIdentifier& identifier, int motion, const BasicMotion& value); 196 void SetMotion(const PadIdentifier& identifier, int motion, const BasicMotion& value);
197 void SetCamera(const PadIdentifier& identifier, const Common::Input::CameraStatus& value);
188 198
189 virtual std::string GetHatButtonName([[maybe_unused]] u8 direction_value) const { 199 virtual std::string GetHatButtonName([[maybe_unused]] u8 direction_value) const {
190 return "Unknown"; 200 return "Unknown";
@@ -197,6 +207,7 @@ private:
197 std::unordered_map<int, float> axes; 207 std::unordered_map<int, float> axes;
198 std::unordered_map<int, BasicMotion> motions; 208 std::unordered_map<int, BasicMotion> motions;
199 Common::Input::BatteryLevel battery{}; 209 Common::Input::BatteryLevel battery{};
210 Common::Input::CameraStatus camera{};
200 }; 211 };
201 212
202 void TriggerOnButtonChange(const PadIdentifier& identifier, int button, bool value); 213 void TriggerOnButtonChange(const PadIdentifier& identifier, int button, bool value);
@@ -205,6 +216,8 @@ private:
205 void TriggerOnBatteryChange(const PadIdentifier& identifier, Common::Input::BatteryLevel value); 216 void TriggerOnBatteryChange(const PadIdentifier& identifier, Common::Input::BatteryLevel value);
206 void TriggerOnMotionChange(const PadIdentifier& identifier, int motion, 217 void TriggerOnMotionChange(const PadIdentifier& identifier, int motion,
207 const BasicMotion& value); 218 const BasicMotion& value);
219 void TriggerOnCameraChange(const PadIdentifier& identifier,
220 const Common::Input::CameraStatus& value);
208 221
209 bool IsInputIdentifierEqual(const InputIdentifier& input_identifier, 222 bool IsInputIdentifierEqual(const InputIdentifier& input_identifier,
210 const PadIdentifier& identifier, EngineInputType type, 223 const PadIdentifier& identifier, EngineInputType type,