libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
Loading...
Searching...
No Matches
ControllerGyroMapping.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <string>
6
7namespace Ship {
8
9#define GYRO_SENSITIVITY_DEFAULT 100
10
19 public:
26 ControllerGyroMapping(PhysicalDeviceType physicalDeviceType, uint8_t portIndex, float sensitivity);
28
34 virtual void UpdatePad(float& x, float& y) = 0;
35
37 virtual void SaveToConfig() = 0;
38
40 virtual void EraseFromConfig() = 0;
41
43 virtual void Recalibrate() = 0;
44
49 virtual std::string GetGyroMappingId() = 0;
50
56
62
67 void SetSensitivity(uint8_t sensitivityPercent);
68
71
77
82 void SetPortIndex(uint8_t portIndex);
83
84 protected:
85 uint8_t mPortIndex;
88};
89} // namespace Ship
Maps a physical gyroscope to virtual gyro input values.
Definition ControllerGyroMapping.h:18
float GetSensitivity()
Returns the current sensitivity multiplier.
virtual void SaveToConfig()=0
Persists this mapping to the application configuration.
virtual std::string GetGyroMappingId()=0
Returns a unique string identifier for this gyro mapping.
void ResetSensitivityToDefault()
Resets the sensitivity to GYRO_SENSITIVITY_DEFAULT.
void SetPortIndex(uint8_t portIndex)
Sets the controller port index for this mapping.
void SetSensitivity(uint8_t sensitivityPercent)
Sets the gyro sensitivity from a percentage value.
virtual void EraseFromConfig()=0
Removes this mapping from the application configuration.
virtual void Recalibrate()=0
Recalibrates the gyroscope to establish a new neutral baseline.
uint8_t mPortIndex
Definition ControllerGyroMapping.h:85
virtual void UpdatePad(float &x, float &y)=0
Reads the physical gyroscope and updates the X and Y gyro values.
bool SensitivityIsDefault()
Checks whether the current sensitivity matches the default value.
float mSensitivity
Definition ControllerGyroMapping.h:87
ControllerGyroMapping(PhysicalDeviceType physicalDeviceType, uint8_t portIndex, float sensitivity)
Constructs a ControllerGyroMapping.
uint8_t GetSensitivityPercent()
Returns the current sensitivity as a percentage of the default.
uint8_t mSensitivityPercent
Definition ControllerGyroMapping.h:86
Base class for controller mappings that represent a physical input.
Definition ControllerInputMapping.h:16
Core namespace for the libultraship engine framework.
Definition gfx_direct3d_common.h:14
PhysicalDeviceType
Identifies the category of a physical input device.
Definition PhysicalDeviceType.h:11