SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SDL::Keycode Class Reference

The SDL virtual key representation. More...

Public Member Functions

constexpr Keycode (SDL_Keycode keycode={})
 Wraps Keycode.
 
constexpr auto operator<=> (const Keycode &other) const =default
 Default comparison operator.
 
constexpr auto operator<=> (SDL_Keycode keycode) const
 Compares with the underlying type.
 
 Keycode (Scancode scancode, Keymod modstate=0, bool key_event=false)
 Get the key code corresponding to the given scancode according to the current keyboard layout.
 
 Keycode (StringParam name)
 Get a key code from a human-readable name.
 
constexpr operator SDL_Keycode () const
 Unwraps to the underlying Keycode.
 
constexpr operator bool () const
 Check if valid.
 
constexpr bool IsExtended () const
 Has Extended flag.
 
constexpr bool IsScancode () const
 Has Scancode flag.
 
Scancode GetScancode (Keymod *modstate) const
 Get the scancode corresponding to the given key code according to the current keyboard layout.
 
const char * GetName () const
 Get a human-readable name for a key.
 

Detailed Description

Values of this type are used to represent keyboard keys using the current layout of the keyboard. These values include Unicode values representing the unmodified character that would be generated by pressing the key, or an SDLK_* constant for those keys that do not generate characters.

A special exception is the number keys at the top of the keyboard which map to SDLK_0...SDLK_9 on AZERTY layouts.

Keys with the SDLK_EXTENDED_MASK bit set do not map to a scancode or unicode code point.

Since
This datatype is available since SDL 3.2.0.

Constructor & Destructor Documentation

◆ Keycode()

constexpr SDL::Keycode::Keycode ( SDL_Keycode  keycode = {})
inlineconstexpr
Parameters
keycodethe value to be wrapped

Member Function Documentation

◆ operator bool()

constexpr SDL::Keycode::operator bool ( ) const
inlineexplicitconstexpr
Returns
True if valid state, false otherwise.

◆ operator SDL_Keycode()

constexpr SDL::Keycode::operator SDL_Keycode ( ) const
inlineconstexpr
Returns
the underlying Keycode.

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