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

Maps a physical input to a virtual analog stick direction. More...

#include <ControllerAxisDirectionMapping.h>

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

Public Member Functions

 ControllerAxisDirectionMapping (PhysicalDeviceType physicalDeviceType, uint8_t portIndex, StickIndex stickIndex, Direction direction, std::shared_ptr< ControlDeck > controlDeck=nullptr)
 Constructs a ControllerAxisDirectionMapping.
 
virtual ~ControllerAxisDirectionMapping ()
 
virtual float GetNormalizedAxisDirectionValue ()=0
 Returns the current axis value normalised to [0, MAX_AXIS_RANGE].
 
virtual int8_t GetMappingType ()
 Returns the mapping type identifier (e.g. gamepad, keyboard).
 
virtual std::string GetAxisDirectionMappingId ()=0
 Returns a unique string identifier for this axis direction mapping.
 
virtual void SaveToConfig ()=0
 Persists this mapping to the application configuration.
 
virtual void EraseFromConfig ()=0
 Removes this mapping from the application configuration.
 
Direction GetDirection ()
 Returns the direction this mapping represents.
 
void SetPortIndex (uint8_t portIndex)
 Sets the controller port index for this mapping.
 
std::shared_ptr< ControlDeckGetControlDeck () const
 
- 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
 
StickIndex mStickIndex
 
Direction mDirection
 
std::shared_ptr< ControlDeckmControlDeck
 
- Protected Attributes inherited from Ship::ControllerMapping
PhysicalDeviceType mPhysicalDeviceType
 

Detailed Description

Maps a physical input to a virtual analog stick direction.

Subclasses implement the details for specific device types (keyboard keys, SDL gamepad axes/buttons, etc.) and convert raw input into a normalised axis value in the range [0, MAX_AXIS_RANGE].

Constructor & Destructor Documentation

◆ ControllerAxisDirectionMapping()

Ship::ControllerAxisDirectionMapping::ControllerAxisDirectionMapping ( PhysicalDeviceType  physicalDeviceType,
uint8_t  portIndex,
StickIndex  stickIndex,
Direction  direction,
std::shared_ptr< ControlDeck controlDeck = nullptr 
)

Constructs a ControllerAxisDirectionMapping.

Parameters
physicalDeviceTypeThe type of physical device this mapping targets.
portIndexThe controller port index this mapping is assigned to.
stickIndexWhich analog stick this mapping affects.
directionThe direction on the stick this mapping represents.

◆ ~ControllerAxisDirectionMapping()

virtual Ship::ControllerAxisDirectionMapping::~ControllerAxisDirectionMapping ( )
virtual

Member Function Documentation

◆ EraseFromConfig()

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

◆ GetAxisDirectionMappingId()

virtual std::string Ship::ControllerAxisDirectionMapping::GetAxisDirectionMappingId ( )
pure virtual

Returns a unique string identifier for this axis direction mapping.

Returns
The mapping identifier string.

Implemented in Ship::KeyboardKeyToAxisDirectionMapping, Ship::MouseButtonToAxisDirectionMapping, Ship::MouseWheelToAxisDirectionMapping, Ship::SDLAxisDirectionToAxisDirectionMapping, and Ship::SDLButtonToAxisDirectionMapping.

◆ GetControlDeck()

std::shared_ptr< ControlDeck > Ship::ControllerAxisDirectionMapping::GetControlDeck ( ) const

◆ GetDirection()

Direction Ship::ControllerAxisDirectionMapping::GetDirection ( )

Returns the direction this mapping represents.

Returns
The Direction enum value.

◆ GetMappingType()

virtual int8_t Ship::ControllerAxisDirectionMapping::GetMappingType ( )
virtual

Returns the mapping type identifier (e.g. gamepad, keyboard).

Returns
The mapping type as a MAPPING_TYPE constant.

Reimplemented in Ship::KeyboardKeyToAxisDirectionMapping, Ship::MouseButtonToAxisDirectionMapping, Ship::MouseWheelToAxisDirectionMapping, Ship::SDLAxisDirectionToAxisDirectionMapping, and Ship::SDLButtonToAxisDirectionMapping.

◆ GetNormalizedAxisDirectionValue()

virtual float Ship::ControllerAxisDirectionMapping::GetNormalizedAxisDirectionValue ( )
pure virtual

Returns the current axis value normalised to [0, MAX_AXIS_RANGE].

Returns
The normalised axis direction value.

Implemented in Ship::KeyboardKeyToAxisDirectionMapping, Ship::MouseButtonToAxisDirectionMapping, Ship::MouseWheelToAxisDirectionMapping, Ship::SDLAxisDirectionToAxisDirectionMapping, and Ship::SDLButtonToAxisDirectionMapping.

◆ SaveToConfig()

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

◆ SetPortIndex()

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

Sets the controller port index for this mapping.

Parameters
portIndexThe new port index.

Member Data Documentation

◆ mControlDeck

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

◆ mDirection

Direction Ship::ControllerAxisDirectionMapping::mDirection
protected

◆ mPortIndex

uint8_t Ship::ControllerAxisDirectionMapping::mPortIndex
protected

◆ mStickIndex

StickIndex Ship::ControllerAxisDirectionMapping::mStickIndex
protected

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