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

Factory for creating ControllerAxisDirectionMapping instances. More...

#include <AxisDirectionMappingFactory.h>

Static Public Member Functions

static std::shared_ptr< ControllerAxisDirectionMappingCreateAxisDirectionMappingFromConfig (uint8_t portIndex, StickIndex stickIndex, std::string id, std::shared_ptr< ConsoleVariable > consoleVariable, std::shared_ptr< ControlDeck > controlDeck, std::shared_ptr< Window > window)
 Deserializes an axis-direction mapping from the configuration string.
 
static std::vector< std::shared_ptr< ControllerAxisDirectionMapping > > CreateDefaultKeyboardAxisDirectionMappings (uint8_t portIndex, StickIndex stickIndex, std::shared_ptr< ConsoleVariable > consoleVariable, std::shared_ptr< ControlDeck > controlDeck, std::shared_ptr< Window > window)
 Creates default keyboard mappings for the given stick and direction.
 
static std::vector< std::shared_ptr< ControllerAxisDirectionMapping > > CreateDefaultSDLAxisDirectionMappings (uint8_t portIndex, StickIndex stickIndex, std::shared_ptr< ConsoleVariable > consoleVariable, std::shared_ptr< ControlDeck > controlDeck)
 Creates default SDL mappings for the given stick.
 
static std::shared_ptr< ControllerAxisDirectionMappingCreateAxisDirectionMappingFromSDLInput (uint8_t portIndex, StickIndex stickIndex, Direction direction, std::shared_ptr< ConsoleVariable > consoleVariable, std::shared_ptr< ControlDeck > controlDeck)
 Creates an axis-direction mapping from live SDL input for interactive binding.
 
static std::shared_ptr< ControllerAxisDirectionMappingCreateAxisDirectionMappingFromMouseWheelInput (uint8_t portIndex, StickIndex stickIndex, Direction direction, std::shared_ptr< ConsoleVariable > consoleVariable, std::shared_ptr< ControlDeck > controlDeck)
 Creates an axis-direction mapping from mouse wheel input for interactive binding.
 

Detailed Description

Factory for creating ControllerAxisDirectionMapping instances.

AxisDirectionMappingFactory provides static helpers to create ControllerAxisDirectionMapping instances from various input sources. It supports deserializing axis mappings from persisted configuration, generating default keyboard and SDL mappings, and creating mappings from live SDL input events during interactive binding.

All factory methods require a ConsoleVariable and ControlDeck to track state and configuration. Keyboard and mouse methods also require a Window for key-capture state.

Typical usage (within ControlDeck or ConfigUI):

portIndex, stickIndex, mappingId, consoleVariable, controlDeck, window);
static std::shared_ptr< ControllerAxisDirectionMapping > CreateAxisDirectionMappingFromConfig(uint8_t portIndex, StickIndex stickIndex, std::string id, std::shared_ptr< ConsoleVariable > consoleVariable, std::shared_ptr< ControlDeck > controlDeck, std::shared_ptr< Window > window)
Deserializes an axis-direction mapping from the configuration string.

Member Function Documentation

◆ CreateAxisDirectionMappingFromConfig()

static std::shared_ptr< ControllerAxisDirectionMapping > Ship::AxisDirectionMappingFactory::CreateAxisDirectionMappingFromConfig ( uint8_t  portIndex,
StickIndex  stickIndex,
std::string  id,
std::shared_ptr< ConsoleVariable consoleVariable,
std::shared_ptr< ControlDeck controlDeck,
std::shared_ptr< Window window 
)
static

Deserializes an axis-direction mapping from the configuration string.

Parameters
portIndexThe controller port index (0-based).
stickIndexWhich stick (C-Stick or Main Stick).
idConfiguration string encoding the input source and direction.
consoleVariableConsoleVariable for persisting the mapping.
controlDeckControlDeck for physical device access.
windowWindow for keyboard input state tracking.
Returns
The deserialized mapping, or nullptr if the configuration string is invalid.

◆ CreateAxisDirectionMappingFromMouseWheelInput()

static std::shared_ptr< ControllerAxisDirectionMapping > Ship::AxisDirectionMappingFactory::CreateAxisDirectionMappingFromMouseWheelInput ( uint8_t  portIndex,
StickIndex  stickIndex,
Direction  direction,
std::shared_ptr< ConsoleVariable consoleVariable,
std::shared_ptr< ControlDeck controlDeck 
)
static

Creates an axis-direction mapping from mouse wheel input for interactive binding.

Parameters
portIndexThe controller port index (0-based).
stickIndexWhich stick (C-Stick or Main Stick).
directionDirection being mapped (Up, Down, Left, Right).
consoleVariableConsoleVariable for persisting the mapping.
controlDeckControlDeck for physical device access.
Returns
The newly created mapping, or nullptr if input detection failed.

◆ CreateAxisDirectionMappingFromSDLInput()

static std::shared_ptr< ControllerAxisDirectionMapping > Ship::AxisDirectionMappingFactory::CreateAxisDirectionMappingFromSDLInput ( uint8_t  portIndex,
StickIndex  stickIndex,
Direction  direction,
std::shared_ptr< ConsoleVariable consoleVariable,
std::shared_ptr< ControlDeck controlDeck 
)
static

Creates an axis-direction mapping from live SDL input for interactive binding.

Parameters
portIndexThe controller port index (0-based).
stickIndexWhich stick (C-Stick or Main Stick).
directionDirection being mapped (Up, Down, Left, Right).
consoleVariableConsoleVariable for persisting the mapping.
controlDeckControlDeck for physical device access.
Returns
The newly created mapping, or nullptr if input detection failed.

◆ CreateDefaultKeyboardAxisDirectionMappings()

static std::vector< std::shared_ptr< ControllerAxisDirectionMapping > > Ship::AxisDirectionMappingFactory::CreateDefaultKeyboardAxisDirectionMappings ( uint8_t  portIndex,
StickIndex  stickIndex,
std::shared_ptr< ConsoleVariable consoleVariable,
std::shared_ptr< ControlDeck controlDeck,
std::shared_ptr< Window window 
)
static

Creates default keyboard mappings for the given stick and direction.

Parameters
portIndexThe controller port index (0-based).
stickIndexWhich stick (C-Stick or Main Stick).
consoleVariableConsoleVariable for persisting mappings.
controlDeckControlDeck for physical device access.
windowWindow for keyboard input state tracking.
Returns
Vector of keyboard mappings (typically 4, one per direction).

◆ CreateDefaultSDLAxisDirectionMappings()

static std::vector< std::shared_ptr< ControllerAxisDirectionMapping > > Ship::AxisDirectionMappingFactory::CreateDefaultSDLAxisDirectionMappings ( uint8_t  portIndex,
StickIndex  stickIndex,
std::shared_ptr< ConsoleVariable consoleVariable,
std::shared_ptr< ControlDeck controlDeck 
)
static

Creates default SDL mappings for the given stick.

Parameters
portIndexThe controller port index (0-based).
stickIndexWhich stick (C-Stick or Main Stick).
consoleVariableConsoleVariable for persisting mappings.
controlDeckControlDeck for physical device access.
Returns
Vector of SDL axis mappings (typically 4, one per direction).

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