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

Base class for mappings that bind a keyboard key to any controller input. More...

#include <KeyboardKeyToAnyMapping.h>

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

Public Member Functions

 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.
 
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::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.
 

Protected Attributes

KbScancode mKeyboardScancode
 
bool mKeyPressed
 
std::shared_ptr< WindowmWindow
 
- Protected Attributes inherited from Ship::ControllerMapping
PhysicalDeviceType mPhysicalDeviceType
 

Detailed Description

Base class for mappings that bind a keyboard key to any controller input.

Provides shared keyboard event processing and physical device/input name reporting. Concrete subclasses (KeyboardKeyToButtonMapping, KeyboardKeyToAxisDirectionMapping) add the target input semantics.

Constructor & Destructor Documentation

◆ KeyboardKeyToAnyMapping()

Ship::KeyboardKeyToAnyMapping::KeyboardKeyToAnyMapping ( KbScancode  scancode,
std::shared_ptr< Window window 
)

Constructs a keyboard-key mapping for the given scan code.

Parameters
scancodeThe keyboard scan code to bind.

◆ ~KeyboardKeyToAnyMapping()

virtual Ship::KeyboardKeyToAnyMapping::~KeyboardKeyToAnyMapping ( )
virtual

Destructor.

Member Function Documentation

◆ GetPhysicalDeviceName()

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

Returns the human-readable name of the keyboard device.

Reimplemented from Ship::ControllerMapping.

Reimplemented in Ship::KeyboardKeyToAxisDirectionMapping, and Ship::KeyboardKeyToButtonMapping.

◆ GetPhysicalInputName()

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

Returns the human-readable name of the bound key.

Reimplemented from Ship::ControllerInputMapping.

Reimplemented in Ship::KeyboardKeyToAxisDirectionMapping, and Ship::KeyboardKeyToButtonMapping.

◆ ProcessKeyboardEvent()

bool Ship::KeyboardKeyToAnyMapping::ProcessKeyboardEvent ( KbEventType  eventType,
KbScancode  scancode 
)

Processes a raw keyboard event and updates the internal pressed state.

Parameters
eventTypeThe type of keyboard event (key-down, key-up, or all-keys-up).
scancodeThe scan code associated with the event.
Returns
true if this mapping's key was affected by the event.

Member Data Documentation

◆ mKeyboardScancode

KbScancode Ship::KeyboardKeyToAnyMapping::mKeyboardScancode
protected

◆ mKeyPressed

bool Ship::KeyboardKeyToAnyMapping::mKeyPressed
protected

◆ mWindow

std::shared_ptr<Window> Ship::KeyboardKeyToAnyMapping::mWindow
protected

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