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

N64-specific controller default mapping configuration. More...

#include <ControllerDefaultMappings.h>

Inheritance diagram for LUS::ControllerDefaultMappings:
[legend]
Collaboration diagram for LUS::ControllerDefaultMappings:
[legend]

Public Member Functions

 ControllerDefaultMappings (std::unordered_map< CONTROLLERBUTTONS_T, std::unordered_set< Ship::KbScancode > > defaultKeyboardKeyToButtonMappings, std::unordered_map< Ship::StickIndex, std::vector< std::pair< Ship::Direction, Ship::KbScancode > > > defaultKeyboardKeyToAxisDirectionMappings, std::unordered_map< CONTROLLERBUTTONS_T, std::unordered_set< SDL_GameControllerButton > > defaultSDLButtonToButtonMappings, std::unordered_map< Ship::StickIndex, std::vector< std::pair< Ship::Direction, SDL_GameControllerButton > > > defaultSDLButtonToAxisDirectionMappings, std::unordered_map< CONTROLLERBUTTONS_T, std::vector< std::pair< SDL_GameControllerAxis, int32_t > > > defaultSDLAxisDirectionToButtonMappings, std::unordered_map< Ship::StickIndex, std::vector< std::pair< Ship::Direction, std::pair< SDL_GameControllerAxis, int32_t > > > > defaultSDLAxisDirectionToAxisDirectionMappings)
 Full constructor — supply all default mapping tables explicitly.
 
 ControllerDefaultMappings ()
 Constructs with an empty mapping table (all defaults are unset).
 
 ~ControllerDefaultMappings ()
 
- Public Member Functions inherited from Ship::ControllerDefaultMappings
 ControllerDefaultMappings (std::unordered_map< CONTROLLERBUTTONS_T, std::unordered_set< KbScancode > > defaultKeyboardKeyToButtonMappings, std::unordered_map< StickIndex, std::vector< std::pair< Direction, KbScancode > > > defaultKeyboardKeyToAxisDirectionMappings, std::unordered_map< CONTROLLERBUTTONS_T, std::unordered_set< SDL_GameControllerButton > > defaultSDLButtonToButtonMappings, std::unordered_map< StickIndex, std::vector< std::pair< Direction, SDL_GameControllerButton > > > defaultSDLButtonToAxisDirectionMappings, std::unordered_map< CONTROLLERBUTTONS_T, std::vector< std::pair< SDL_GameControllerAxis, int32_t > > > defaultSDLAxisDirectionToButtonMappings, std::unordered_map< StickIndex, std::vector< std::pair< Direction, std::pair< SDL_GameControllerAxis, int32_t > > > > defaultSDLAxisDirectionToAxisDirectionMappings)
 Constructs a ControllerDefaultMappings with fully specified default tables.
 
 ControllerDefaultMappings ()
 Constructs a ControllerDefaultMappings with empty default tables.
 
 ~ControllerDefaultMappings ()
 
std::unordered_map< CONTROLLERBUTTONS_T, std::unordered_set< KbScancode > > GetDefaultKeyboardKeyToButtonMappings ()
 Returns the default keyboard-key-to-button mappings.
 
std::unordered_map< StickIndex, std::vector< std::pair< Direction, KbScancode > > > GetDefaultKeyboardKeyToAxisDirectionMappings ()
 Returns the default keyboard-key-to-axis-direction mappings.
 
std::unordered_map< CONTROLLERBUTTONS_T, std::unordered_set< SDL_GameControllerButton > > GetDefaultSDLButtonToButtonMappings ()
 Returns the default SDL-button-to-button mappings.
 
std::unordered_map< StickIndex, std::vector< std::pair< Direction, SDL_GameControllerButton > > > GetDefaultSDLButtonToAxisDirectionMappings ()
 Returns the default SDL-button-to-axis-direction mappings.
 
std::unordered_map< CONTROLLERBUTTONS_T, std::vector< std::pair< SDL_GameControllerAxis, int32_t > > > GetDefaultSDLAxisDirectionToButtonMappings ()
 Returns the default SDL-axis-direction-to-button mappings.
 
std::unordered_map< StickIndex, std::vector< std::pair< Direction, std::pair< SDL_GameControllerAxis, int32_t > > > > GetDefaultSDLAxisDirectionToAxisDirectionMappings ()
 Returns the default SDL-axis-direction-to-axis-direction mappings.
 

Additional Inherited Members

- Protected Member Functions inherited from Ship::ControllerDefaultMappings
virtual void SetDefaultKeyboardKeyToAxisDirectionMappings (std::unordered_map< StickIndex, std::vector< std::pair< Direction, KbScancode > > > defaultKeyboardKeyToAxisDirectionMappings)
 Replaces the default keyboard-key-to-axis-direction mappings.
 
virtual void SetDefaultSDLButtonToAxisDirectionMappings (std::unordered_map< StickIndex, std::vector< std::pair< Direction, SDL_GameControllerButton > > > defaultSDLButtonToAxisDirectionMappings)
 Replaces the default SDL-button-to-axis-direction mappings.
 
virtual void SetDefaultSDLAxisDirectionToAxisDirectionMappings (std::unordered_map< StickIndex, std::vector< std::pair< Direction, std::pair< SDL_GameControllerAxis, int32_t > > > > defaultSDLAxisDirectionToAxisDirectionMappings)
 Replaces the default SDL-axis-direction-to-axis-direction mappings.
 

Detailed Description

N64-specific controller default mapping configuration.

LUS::ControllerDefaultMappings is the concrete ControllerDefaultMappings subclass used by libultraship. It provides the standard N64 button layout for keyboard, SDL gamepad buttons, and SDL axis-to-button mappings so that newly connected devices receive sensible default bindings out of the box.

Pass an instance to LUS::ControlDeck (or Ship::ControlDeck) to customise the default mappings applied when a new physical device is detected.

Constructor & Destructor Documentation

◆ ControllerDefaultMappings() [1/2]

LUS::ControllerDefaultMappings::ControllerDefaultMappings ( std::unordered_map< CONTROLLERBUTTONS_T, std::unordered_set< Ship::KbScancode > >  defaultKeyboardKeyToButtonMappings,
std::unordered_map< Ship::StickIndex, std::vector< std::pair< Ship::Direction, Ship::KbScancode > > >  defaultKeyboardKeyToAxisDirectionMappings,
std::unordered_map< CONTROLLERBUTTONS_T, std::unordered_set< SDL_GameControllerButton > >  defaultSDLButtonToButtonMappings,
std::unordered_map< Ship::StickIndex, std::vector< std::pair< Ship::Direction, SDL_GameControllerButton > > >  defaultSDLButtonToAxisDirectionMappings,
std::unordered_map< CONTROLLERBUTTONS_T, std::vector< std::pair< SDL_GameControllerAxis, int32_t > > >  defaultSDLAxisDirectionToButtonMappings,
std::unordered_map< Ship::StickIndex, std::vector< std::pair< Ship::Direction, std::pair< SDL_GameControllerAxis, int32_t > > > >  defaultSDLAxisDirectionToAxisDirectionMappings 
)

Full constructor — supply all default mapping tables explicitly.

Parameters
defaultKeyboardKeyToButtonMappingsButton → keyboard key default bindings.
defaultKeyboardKeyToAxisDirectionMappingsStick direction → keyboard key default bindings.
defaultSDLButtonToButtonMappingsButton → SDL gamepad button default bindings.
defaultSDLButtonToAxisDirectionMappingsStick direction → SDL button default bindings.
defaultSDLAxisDirectionToButtonMappingsButton → SDL axis default bindings.
defaultSDLAxisDirectionToAxisDirectionMappingsStick direction → SDL axis default bindings.

◆ ControllerDefaultMappings() [2/2]

LUS::ControllerDefaultMappings::ControllerDefaultMappings ( )

Constructs with an empty mapping table (all defaults are unset).

Use this when you want to build defaults incrementally via the base-class setters.

◆ ~ControllerDefaultMappings()

LUS::ControllerDefaultMappings::~ControllerDefaultMappings ( )

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