summaryrefslogtreecommitdiff
path: root/src/input_common/drivers/android.h
diff options
context:
space:
mode:
authorGravatar Charles Lombardo2024-01-18 09:16:58 -0500
committerGravatar GitHub2024-01-18 09:16:58 -0500
commit3092855d5ae1724ccef4d267e74b79b7790814f0 (patch)
treed605942f87e77856c2a19c95c627ce178db6f706 /src/input_common/drivers/android.h
parentMerge pull request #12699 from t895/overlay-saving (diff)
parentinput_common: Add android input engine (diff)
downloadyuzu-3092855d5ae1724ccef4d267e74b79b7790814f0.tar.gz
yuzu-3092855d5ae1724ccef4d267e74b79b7790814f0.tar.xz
yuzu-3092855d5ae1724ccef4d267e74b79b7790814f0.zip
Merge pull request #12702 from german77/android-input
input_common: Add android input engine
Diffstat (limited to 'src/input_common/drivers/android.h')
-rw-r--r--src/input_common/drivers/android.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/input_common/drivers/android.h b/src/input_common/drivers/android.h
new file mode 100644
index 000000000..3f01817f6
--- /dev/null
+++ b/src/input_common/drivers/android.h
@@ -0,0 +1,54 @@
1// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-3.0-or-later
3
4#pragma once
5
6#include "input_common/input_engine.h"
7
8namespace InputCommon {
9
10/**
11 * A virtual controller that is always assigned to the game input
12 */
13class Android final : public InputEngine {
14public:
15 explicit Android(std::string input_engine_);
16
17 /**
18 * Registers controller number to accept new inputs
19 * @param controller_number the controller number that will take this action
20 */
21 void RegisterController(std::size_t controller_number);
22
23 /**
24 * Sets the status of all buttons bound with the key to pressed
25 * @param controller_number the controller number that will take this action
26 * @param button_id the id of the button
27 * @param value indicates if the button is pressed or not
28 */
29 void SetButtonState(std::size_t controller_number, int button_id, bool value);
30
31 /**
32 * Sets the status of a analog input to a specific player index
33 * @param controller_number the controller number that will take this action
34 * @param axis_id the id of the axis to move
35 * @param value the analog position of the axis
36 */
37 void SetAxisState(std::size_t controller_number, int axis_id, float value);
38
39 /**
40 * Sets the status of the motion sensor to a specific player index
41 * @param controller_number the controller number that will take this action
42 * @param delta_timestamp time passed since last reading
43 * @param gyro_x,gyro_y,gyro_z the gyro sensor readings
44 * @param accel_x,accel_y,accel_z the accelerometer reading
45 */
46 void SetMotionState(std::size_t controller_number, u64 delta_timestamp, float gyro_x,
47 float gyro_y, float gyro_z, float accel_x, float accel_y, float accel_z);
48
49private:
50 /// Returns the correct identifier corresponding to the player index
51 PadIdentifier GetIdentifier(std::size_t controller_number) const;
52};
53
54} // namespace InputCommon