diff options
author | Charles Lombardo <clombardo169@gmail.com> | 2024-01-18 09:16:58 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-18 09:16:58 -0500 |
commit | 3092855d5ae1724ccef4d267e74b79b7790814f0 (patch) | |
tree | d605942f87e77856c2a19c95c627ce178db6f706 /src/input_common/drivers/android.h | |
parent | c87b96435d7640a2de62a26ad773f806ab9800e2 (diff) | |
parent | 72f803c366f5406bc0098821f237c6185d1ed034 (diff) |
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.h | 54 |
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 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include "input_common/input_engine.h" + +namespace InputCommon { + +/** + * A virtual controller that is always assigned to the game input + */ +class Android final : public InputEngine { +public: + explicit Android(std::string input_engine_); + + /** + * Registers controller number to accept new inputs + * @param controller_number the controller number that will take this action + */ + void RegisterController(std::size_t controller_number); + + /** + * Sets the status of all buttons bound with the key to pressed + * @param controller_number the controller number that will take this action + * @param button_id the id of the button + * @param value indicates if the button is pressed or not + */ + void SetButtonState(std::size_t controller_number, int button_id, bool value); + + /** + * Sets the status of a analog input to a specific player index + * @param controller_number the controller number that will take this action + * @param axis_id the id of the axis to move + * @param value the analog position of the axis + */ + void SetAxisState(std::size_t controller_number, int axis_id, float value); + + /** + * Sets the status of the motion sensor to a specific player index + * @param controller_number the controller number that will take this action + * @param delta_timestamp time passed since last reading + * @param gyro_x,gyro_y,gyro_z the gyro sensor readings + * @param accel_x,accel_y,accel_z the accelerometer reading + */ + void SetMotionState(std::size_t controller_number, u64 delta_timestamp, float gyro_x, + float gyro_y, float gyro_z, float accel_x, float accel_y, float accel_z); + +private: + /// Returns the correct identifier corresponding to the player index + PadIdentifier GetIdentifier(std::size_t controller_number) const; +}; + +} // namespace InputCommon |