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

Maps a keyboard key to a virtual analog stick direction. More...

#include <KeyboardKeyToAxisDirectionMapping.h>

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

Public Member Functions

 KeyboardKeyToAxisDirectionMapping (uint8_t portIndex, StickIndex stickIndex, Direction direction, KbScancode scancode, std::shared_ptr< ControlDeck > controlDeck=nullptr, std::shared_ptr< Window > window=nullptr, std::shared_ptr< ConsoleVariable > consoleVariable=nullptr)
 Constructs a keyboard-key-to-axis-direction mapping.
 
float GetNormalizedAxisDirectionValue () override
 Returns the normalised axis value (0 or MAX_AXIS_RANGE).
 
std::string GetAxisDirectionMappingId () override
 Returns the unique string identifier for this mapping.
 
int8_t GetMappingType () override
 Returns the mapping type identifier.
 
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 keyboard device.
 
std::string GetPhysicalInputName () override
 Returns the human-readable name of the bound key.
 
- Public Member Functions inherited from Ship::KeyboardKeyToAnyMapping
 KeyboardKeyToAnyMapping (KbScancode scancode, std::shared_ptr< Window > window)
 Constructs a keyboard-key mapping for the given scan code.
 
virtual ~KeyboardKeyToAnyMapping ()
 Destructor.
 
bool ProcessKeyboardEvent (KbEventType eventType, KbScancode scancode)
 Processes a raw keyboard event and updates the internal pressed state.
 
- Public Member Functions inherited from Ship::ControllerInputMapping
 ControllerInputMapping (PhysicalDeviceType physicalDeviceType)
 Constructs a ControllerInputMapping for the given physical device type.
 
 ~ControllerInputMapping ()
 
- 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.
 
- Public Member Functions inherited from Ship::ControllerAxisDirectionMapping
 ControllerAxisDirectionMapping (PhysicalDeviceType physicalDeviceType, uint8_t portIndex, StickIndex stickIndex, Direction direction, std::shared_ptr< ControlDeck > controlDeck=nullptr)
 Constructs a ControllerAxisDirectionMapping.
 
virtual ~ControllerAxisDirectionMapping ()
 
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
 

Protected Attributes

std::shared_ptr< ConsoleVariablemConsoleVariable
 
std::shared_ptr< ControlDeckmControlDeck
 
- Protected Attributes inherited from Ship::KeyboardKeyToAnyMapping
KbScancode mKeyboardScancode
 
bool mKeyPressed
 
std::shared_ptr< WindowmWindow
 
- Protected Attributes inherited from Ship::ControllerMapping
PhysicalDeviceType mPhysicalDeviceType
 
- Protected Attributes inherited from Ship::ControllerAxisDirectionMapping
uint8_t mPortIndex
 
StickIndex mStickIndex
 
Direction mDirection
 
std::shared_ptr< ControlDeckmControlDeck
 

Detailed Description

Maps a keyboard key to a virtual analog stick direction.

When the bound key is pressed the mapping reports full deflection in the configured direction; when released the value is zero.

Constructor & Destructor Documentation

◆ KeyboardKeyToAxisDirectionMapping()

Ship::KeyboardKeyToAxisDirectionMapping::KeyboardKeyToAxisDirectionMapping ( uint8_t  portIndex,
StickIndex  stickIndex,
Direction  direction,
KbScancode  scancode,
std::shared_ptr< ControlDeck controlDeck = nullptr,
std::shared_ptr< Window window = nullptr,
std::shared_ptr< ConsoleVariable consoleVariable = nullptr 
)

Constructs a keyboard-key-to-axis-direction mapping.

Parameters
portIndexThe controller port index.
stickIndexWhich analog stick this mapping targets.
directionThe stick direction to activate.
scancodeThe keyboard scan code to bind.

Member Function Documentation

◆ EraseFromConfig()

void Ship::KeyboardKeyToAxisDirectionMapping::EraseFromConfig ( )
overridevirtual

Removes this mapping from the application configuration.

Implements Ship::ControllerAxisDirectionMapping.

◆ GetAxisDirectionMappingId()

std::string Ship::KeyboardKeyToAxisDirectionMapping::GetAxisDirectionMappingId ( )
overridevirtual

Returns the unique string identifier for this mapping.

Implements Ship::ControllerAxisDirectionMapping.

◆ GetMappingType()

int8_t Ship::KeyboardKeyToAxisDirectionMapping::GetMappingType ( )
overridevirtual

Returns the mapping type identifier.

Reimplemented from Ship::ControllerAxisDirectionMapping.

◆ GetNormalizedAxisDirectionValue()

float Ship::KeyboardKeyToAxisDirectionMapping::GetNormalizedAxisDirectionValue ( )
overridevirtual

Returns the normalised axis value (0 or MAX_AXIS_RANGE).

Implements Ship::ControllerAxisDirectionMapping.

◆ GetPhysicalDeviceName()

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

Returns the human-readable name of the keyboard device.

Reimplemented from Ship::KeyboardKeyToAnyMapping.

◆ GetPhysicalInputName()

std::string Ship::KeyboardKeyToAxisDirectionMapping::GetPhysicalInputName ( )
overridevirtual

Returns the human-readable name of the bound key.

Reimplemented from Ship::KeyboardKeyToAnyMapping.

◆ SaveToConfig()

void Ship::KeyboardKeyToAxisDirectionMapping::SaveToConfig ( )
overridevirtual

Persists this mapping to the application configuration.

Implements Ship::ControllerAxisDirectionMapping.

Member Data Documentation

◆ mConsoleVariable

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

◆ mControlDeck

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

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