|
libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
|
Maps an SDL gamepad's gyroscope sensor to a virtual gyro input. More...
#include <SDLGyroMapping.h>
Public Member Functions | |
| SDLGyroMapping (uint8_t portIndex, float sensitivity, float neutralPitch, float neutralYaw, float neutralRoll, std::shared_ptr< ControlDeck > controlDeck=nullptr, std::shared_ptr< ConsoleVariable > consoleVariable=nullptr) | |
| Constructs an SDL gyro mapping with calibration offsets. | |
| void | UpdatePad (float &x, float &y) override |
| Reads the gyro sensor and writes the resulting X/Y values. | |
| void | SaveToConfig () override |
| Persists this mapping to the application configuration. | |
| void | EraseFromConfig () override |
| Removes this mapping from the application configuration. | |
| void | Recalibrate () override |
| Samples the current sensor output and recalculates neutral offsets. | |
| std::string | GetGyroMappingId () override |
| Returns the unique string identifier for this mapping. | |
| std::string | GetPhysicalDeviceName () override |
| Returns the human-readable name of the SDL gamepad device. | |
Public Member Functions inherited from Ship::ControllerGyroMapping | |
| ControllerGyroMapping (PhysicalDeviceType physicalDeviceType, uint8_t portIndex, float sensitivity) | |
| Constructs a ControllerGyroMapping. | |
| virtual | ~ControllerGyroMapping () |
| float | GetSensitivity () |
| Returns the current sensitivity multiplier. | |
| uint8_t | GetSensitivityPercent () |
| Returns the current sensitivity as a percentage of the default. | |
| void | SetSensitivity (uint8_t sensitivityPercent) |
| Sets the gyro sensitivity from a percentage value. | |
| void | ResetSensitivityToDefault () |
| Resets the sensitivity to GYRO_SENSITIVITY_DEFAULT. | |
| bool | SensitivityIsDefault () |
| Checks whether the current sensitivity matches the default value. | |
| void | SetPortIndex (uint8_t portIndex) |
| Sets the controller port index for this mapping. | |
Public Member Functions inherited from Ship::ControllerInputMapping | |
| ControllerInputMapping (PhysicalDeviceType physicalDeviceType) | |
| Constructs a ControllerInputMapping for the given physical device type. | |
| ~ControllerInputMapping () | |
| virtual std::string | GetPhysicalInputName () |
| Returns a human-readable name for the physical input this mapping represents. | |
Public Member Functions inherited from Ship::ControllerMapping | |
| ControllerMapping (PhysicalDeviceType physicalDeviceType) | |
| Constructs a ControllerMapping for the given physical device type. | |
| ~ControllerMapping () | |
| PhysicalDeviceType | GetPhysicalDeviceType () |
| Returns the physical device type for this mapping. | |
Protected Attributes | |
| std::shared_ptr< ConsoleVariable > | mConsoleVariable |
| std::shared_ptr< ControlDeck > | mControlDeck |
Protected Attributes inherited from Ship::ControllerGyroMapping | |
| uint8_t | mPortIndex |
| uint8_t | mSensitivityPercent |
| float | mSensitivity |
Protected Attributes inherited from Ship::ControllerMapping | |
| PhysicalDeviceType | mPhysicalDeviceType |
Maps an SDL gamepad's gyroscope sensor to a virtual gyro input.
Reads pitch, yaw, and roll from the SDL motion sensor and converts them into X/Y gyro values after subtracting the neutral calibration offsets.
| Ship::SDLGyroMapping::SDLGyroMapping | ( | uint8_t | portIndex, |
| float | sensitivity, | ||
| float | neutralPitch, | ||
| float | neutralYaw, | ||
| float | neutralRoll, | ||
| std::shared_ptr< ControlDeck > | controlDeck = nullptr, |
||
| std::shared_ptr< ConsoleVariable > | consoleVariable = nullptr |
||
| ) |
Constructs an SDL gyro mapping with calibration offsets.
| portIndex | The controller port index. |
| sensitivity | Gyro sensitivity multiplier. |
| neutralPitch | Pitch value at rest (calibration offset). |
| neutralYaw | Yaw value at rest (calibration offset). |
| neutralRoll | Roll value at rest (calibration offset). |
|
overridevirtual |
Removes this mapping from the application configuration.
Implements Ship::ControllerGyroMapping.
|
overridevirtual |
Returns the unique string identifier for this mapping.
Implements Ship::ControllerGyroMapping.
|
overridevirtual |
Returns the human-readable name of the SDL gamepad device.
Reimplemented from Ship::ControllerMapping.
|
overridevirtual |
Samples the current sensor output and recalculates neutral offsets.
Implements Ship::ControllerGyroMapping.
|
overridevirtual |
Persists this mapping to the application configuration.
Implements Ship::ControllerGyroMapping.
|
overridevirtual |
Reads the gyro sensor and writes the resulting X/Y values.
| x | Reference to receive the horizontal gyro component. |
| y | Reference to receive the vertical gyro component. |
Implements Ship::ControllerGyroMapping.
|
protected |
|
protected |