Manages the single gyroscope (motion sensor) mapping for a controller port.
More...
#include <ControllerGyro.h>
Manages the single gyroscope (motion sensor) mapping for a controller port.
Unlike buttons and sticks, a controller supports at most one ControllerGyroMapping at a time. ControllerGyro provides a thin wrapper that loads/saves the mapping from Config and exposes UpdatePad() to integrate gyroscope data into the game's pad state.
◆ ControllerGyro()
| Ship::ControllerGyro::ControllerGyro |
( |
uint8_t |
portIndex, |
|
|
std::shared_ptr< ConsoleVariable > |
consoleVariable = nullptr, |
|
|
std::shared_ptr< ControlDeck > |
controlDeck = nullptr |
|
) |
| |
Constructs a ControllerGyro for the given port.
- Parameters
-
| portIndex | Zero-based port index. |
◆ ~ControllerGyro()
| Ship::ControllerGyro::~ControllerGyro |
( |
| ) |
|
◆ ClearGyroMapping()
| void Ship::ControllerGyro::ClearGyroMapping |
( |
| ) |
|
Removes the in-memory gyro mapping (does not touch Config).
◆ GetGyroMapping()
Returns the current gyro mapping, or nullptr if none is assigned.
◆ HasMappingForPhysicalDeviceType()
| bool Ship::ControllerGyro::HasMappingForPhysicalDeviceType |
( |
PhysicalDeviceType |
physicalDeviceType | ) |
|
Returns true if the current gyro mapping targets the given device type.
- Parameters
-
| physicalDeviceType | Device type to query. |
◆ ReloadGyroMappingFromConfig()
| void Ship::ControllerGyro::ReloadGyroMappingFromConfig |
( |
| ) |
|
Clears any in-memory mapping and reloads it from Config.
◆ SaveGyroMappingIdToConfig()
| void Ship::ControllerGyro::SaveGyroMappingIdToConfig |
( |
| ) |
|
Writes the current gyro mapping ID to Config.
◆ SetControlDeck()
| void Ship::ControllerGyro::SetControlDeck |
( |
std::shared_ptr< ControlDeck > |
controlDeck | ) |
|
|
inline |
◆ SetGyroMapping()
Sets the active gyro mapping, replacing any previously set one.
- Parameters
-
| mapping | New mapping to use. |
◆ SetGyroMappingFromRawPress()
| bool Ship::ControllerGyro::SetGyroMappingFromRawPress |
( |
| ) |
|
Listens for the next raw gyro input and creates a mapping from it.
- Returns
- true if a mapping was successfully created.
◆ UpdatePad()
| void Ship::ControllerGyro::UpdatePad |
( |
float & |
x, |
|
|
float & |
y |
|
) |
| |
Reads gyroscope data from the active mapping and writes it to x and y.
- Parameters
-
| x | Output X-axis (pitch) gyro value. |
| y | Output Y-axis (yaw/roll) gyro value. |
The documentation for this class was generated from the following file: