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

Maps an SDL gamepad's haptic motors to a controller rumble output. More...

#include <SDLRumbleMapping.h>

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

Public Member Functions

 SDLRumbleMapping (uint8_t portIndex, uint8_t lowFrequencyIntensityPercentage, uint8_t highFrequencyIntensityPercentage, std::shared_ptr< ControlDeck > controlDeck=nullptr, std::shared_ptr< ConsoleVariable > consoleVariable=nullptr)
 Constructs an SDL rumble mapping.
 
void StartRumble () override
 Starts the rumble effect with the configured intensities.
 
void StopRumble () override
 Stops any active rumble effect.
 
void SetLowFrequencyIntensity (uint8_t intensityPercentage) override
 Sets the low-frequency motor intensity.
 
void SetHighFrequencyIntensity (uint8_t intensityPercentage) override
 Sets the high-frequency motor intensity.
 
std::string GetRumbleMappingId () override
 Returns the unique string identifier for this mapping.
 
void SaveToConfig () override
 Persists this mapping to the application configuration.
 
void EraseFromConfig () override
 Removes this mapping from the application configuration.
 
std::string GetPhysicalDeviceName () override
 Returns the human-readable name of the SDL gamepad device.
 
- Public Member Functions inherited from Ship::ControllerRumbleMapping
 ControllerRumbleMapping (PhysicalDeviceType physicalDeviceType, uint8_t portIndex, uint8_t lowFrequencyIntensityPercentage, uint8_t highFrequencyIntensityPercentage)
 Constructs a ControllerRumbleMapping.
 
 ~ControllerRumbleMapping ()
 
uint8_t GetLowFrequencyIntensityPercentage ()
 Returns the current low-frequency rumble intensity percentage.
 
uint8_t GetHighFrequencyIntensityPercentage ()
 Returns the current high-frequency rumble intensity percentage.
 
bool HighFrequencyIntensityIsDefault ()
 Checks whether the high-frequency intensity is at its default value.
 
bool LowFrequencyIntensityIsDefault ()
 Checks whether the low-frequency intensity is at its default value.
 
void ResetHighFrequencyIntensityToDefault ()
 Resets high-frequency rumble intensity to DEFAULT_HIGH_FREQUENCY_RUMBLE_PERCENTAGE.
 
void ResetLowFrequencyIntensityToDefault ()
 Resets low-frequency rumble intensity to DEFAULT_LOW_FREQUENCY_RUMBLE_PERCENTAGE.
 
void SetPortIndex (uint8_t portIndex)
 Sets the controller port index for this mapping.
 
- 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< ConsoleVariablemConsoleVariable
 
std::shared_ptr< ControlDeckmControlDeck
 
- Protected Attributes inherited from Ship::ControllerRumbleMapping
uint8_t mPortIndex
 
uint8_t mLowFrequencyIntensityPercentage
 
uint8_t mHighFrequencyIntensityPercentage
 
- Protected Attributes inherited from Ship::ControllerMapping
PhysicalDeviceType mPhysicalDeviceType
 

Detailed Description

Maps an SDL gamepad's haptic motors to a controller rumble output.

Controls the low-frequency and high-frequency rumble motors through the SDL haptic API, with configurable intensity percentages.

Constructor & Destructor Documentation

◆ SDLRumbleMapping()

Ship::SDLRumbleMapping::SDLRumbleMapping ( uint8_t  portIndex,
uint8_t  lowFrequencyIntensityPercentage,
uint8_t  highFrequencyIntensityPercentage,
std::shared_ptr< ControlDeck controlDeck = nullptr,
std::shared_ptr< ConsoleVariable consoleVariable = nullptr 
)

Constructs an SDL rumble mapping.

Parameters
portIndexThe controller port index.
lowFrequencyIntensityPercentageIntensity of the low-frequency motor (0–100).
highFrequencyIntensityPercentageIntensity of the high-frequency motor (0–100).

Member Function Documentation

◆ EraseFromConfig()

void Ship::SDLRumbleMapping::EraseFromConfig ( )
overridevirtual

Removes this mapping from the application configuration.

Implements Ship::ControllerRumbleMapping.

◆ GetPhysicalDeviceName()

std::string Ship::SDLRumbleMapping::GetPhysicalDeviceName ( )
overridevirtual

Returns the human-readable name of the SDL gamepad device.

Reimplemented from Ship::ControllerMapping.

◆ GetRumbleMappingId()

std::string Ship::SDLRumbleMapping::GetRumbleMappingId ( )
overridevirtual

Returns the unique string identifier for this mapping.

Implements Ship::ControllerRumbleMapping.

◆ SaveToConfig()

void Ship::SDLRumbleMapping::SaveToConfig ( )
overridevirtual

Persists this mapping to the application configuration.

Implements Ship::ControllerRumbleMapping.

◆ SetHighFrequencyIntensity()

void Ship::SDLRumbleMapping::SetHighFrequencyIntensity ( uint8_t  intensityPercentage)
overridevirtual

Sets the high-frequency motor intensity.

Parameters
intensityPercentageThe intensity percentage (0–100).

Reimplemented from Ship::ControllerRumbleMapping.

◆ SetLowFrequencyIntensity()

void Ship::SDLRumbleMapping::SetLowFrequencyIntensity ( uint8_t  intensityPercentage)
overridevirtual

Sets the low-frequency motor intensity.

Parameters
intensityPercentageThe intensity percentage (0–100).

Reimplemented from Ship::ControllerRumbleMapping.

◆ StartRumble()

void Ship::SDLRumbleMapping::StartRumble ( )
overridevirtual

Starts the rumble effect with the configured intensities.

Implements Ship::ControllerRumbleMapping.

◆ StopRumble()

void Ship::SDLRumbleMapping::StopRumble ( )
overridevirtual

Stops any active rumble effect.

Implements Ship::ControllerRumbleMapping.

Member Data Documentation

◆ mConsoleVariable

std::shared_ptr<ConsoleVariable> Ship::SDLRumbleMapping::mConsoleVariable
protected

◆ mControlDeck

std::shared_ptr<ControlDeck> Ship::SDLRumbleMapping::mControlDeck
protected

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