libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
Loading...
Searching...
No Matches
Ship::ControllerGyroMapping Class Referenceabstract

Maps a physical gyroscope to virtual gyro input values. More...

#include <ControllerGyroMapping.h>

Inheritance diagram for Ship::ControllerGyroMapping:
[legend]
Collaboration diagram for Ship::ControllerGyroMapping:
[legend]

Public Member Functions

 ControllerGyroMapping (PhysicalDeviceType physicalDeviceType, uint8_t portIndex, float sensitivity)
 Constructs a ControllerGyroMapping.
 
virtual ~ControllerGyroMapping ()
 
virtual void UpdatePad (float &x, float &y)=0
 Reads the physical gyroscope and updates the X and Y gyro values.
 
virtual void SaveToConfig ()=0
 Persists this mapping to the application configuration.
 
virtual void EraseFromConfig ()=0
 Removes this mapping from the application configuration.
 
virtual void Recalibrate ()=0
 Recalibrates the gyroscope to establish a new neutral baseline.
 
virtual std::string GetGyroMappingId ()=0
 Returns a unique string identifier for this gyro mapping.
 
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 ()
 
virtual std::string GetPhysicalDeviceName ()
 Returns a human-readable name for the physical device associated with this mapping.
 
PhysicalDeviceType GetPhysicalDeviceType ()
 Returns the physical device type for this mapping.
 

Protected Attributes

uint8_t mPortIndex
 
uint8_t mSensitivityPercent
 
float mSensitivity
 
- Protected Attributes inherited from Ship::ControllerMapping
PhysicalDeviceType mPhysicalDeviceType
 

Detailed Description

Maps a physical gyroscope to virtual gyro input values.

Subclasses implement device-specific gyroscope reading and convert raw angular velocity data into X/Y values used by the game. Sensitivity can be adjusted as a percentage of the default value.

Constructor & Destructor Documentation

◆ ControllerGyroMapping()

Ship::ControllerGyroMapping::ControllerGyroMapping ( PhysicalDeviceType  physicalDeviceType,
uint8_t  portIndex,
float  sensitivity 
)

Constructs a ControllerGyroMapping.

Parameters
physicalDeviceTypeThe type of physical device this mapping targets.
portIndexThe controller port index this mapping is assigned to.
sensitivityThe gyro sensitivity multiplier.

◆ ~ControllerGyroMapping()

virtual Ship::ControllerGyroMapping::~ControllerGyroMapping ( )
virtual

Member Function Documentation

◆ EraseFromConfig()

virtual void Ship::ControllerGyroMapping::EraseFromConfig ( )
pure virtual

Removes this mapping from the application configuration.

Implemented in Ship::SDLGyroMapping.

◆ GetGyroMappingId()

virtual std::string Ship::ControllerGyroMapping::GetGyroMappingId ( )
pure virtual

Returns a unique string identifier for this gyro mapping.

Returns
The mapping identifier string.

Implemented in Ship::SDLGyroMapping.

◆ GetSensitivity()

float Ship::ControllerGyroMapping::GetSensitivity ( )

Returns the current sensitivity multiplier.

Returns
The sensitivity value as a float.

◆ GetSensitivityPercent()

uint8_t Ship::ControllerGyroMapping::GetSensitivityPercent ( )

Returns the current sensitivity as a percentage of the default.

Returns
The sensitivity percentage (0–255).

◆ Recalibrate()

virtual void Ship::ControllerGyroMapping::Recalibrate ( )
pure virtual

Recalibrates the gyroscope to establish a new neutral baseline.

Implemented in Ship::SDLGyroMapping.

◆ ResetSensitivityToDefault()

void Ship::ControllerGyroMapping::ResetSensitivityToDefault ( )

Resets the sensitivity to GYRO_SENSITIVITY_DEFAULT.

◆ SaveToConfig()

virtual void Ship::ControllerGyroMapping::SaveToConfig ( )
pure virtual

Persists this mapping to the application configuration.

Implemented in Ship::SDLGyroMapping.

◆ SensitivityIsDefault()

bool Ship::ControllerGyroMapping::SensitivityIsDefault ( )

Checks whether the current sensitivity matches the default value.

Returns
true if sensitivity is at the default, false otherwise.

◆ SetPortIndex()

void Ship::ControllerGyroMapping::SetPortIndex ( uint8_t  portIndex)

Sets the controller port index for this mapping.

Parameters
portIndexThe new port index.

◆ SetSensitivity()

void Ship::ControllerGyroMapping::SetSensitivity ( uint8_t  sensitivityPercent)

Sets the gyro sensitivity from a percentage value.

Parameters
sensitivityPercentThe new sensitivity percentage.

◆ UpdatePad()

virtual void Ship::ControllerGyroMapping::UpdatePad ( float &  x,
float &  y 
)
pure virtual

Reads the physical gyroscope and updates the X and Y gyro values.

Parameters
xReference to the X gyro axis value to update.
yReference to the Y gyro axis value to update.

Implemented in Ship::SDLGyroMapping.

Member Data Documentation

◆ mPortIndex

uint8_t Ship::ControllerGyroMapping::mPortIndex
protected

◆ mSensitivity

float Ship::ControllerGyroMapping::mSensitivity
protected

◆ mSensitivityPercent

uint8_t Ship::ControllerGyroMapping::mSensitivityPercent
protected

The documentation for this class was generated from the following file: