galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
galaxy::Keyboard Class Referencefinal

Physical keyboard device and state management. More...

#include <Keyboard.hpp>

Inheritance diagram for galaxy::Keyboard:
Collaboration diagram for galaxy::Keyboard:

Public Member Functions

 Keyboard () noexcept
 Constructor.
 ~Keyboard () noexcept
 Destructor.
void begin_text_input (const SDL_TextInputType input_type, const SDL_Capitalization capitals, const bool multiline) const noexcept
 Enable window to begin processing text input.
bool is_text_input_active () const noexcept
 Is text input active?
void end_text_input () const noexcept
 Disable text input.
void clear_state () const noexcept
 Will clear any existing keyboard state.
bool has_keyboard () const noexcept
 Check if there is a keyboard connected.
bool has_onscreen_keyboard () const noexcept
 Check if an onscreen keyboard is supported.
bool onscreen_keyboard_active () const noexcept
 Check if onscreen keyboard is shown.
bool is_key_mod_down (const KeyMods modifier) const noexcept
 See if a key mod is being held down.
bool is_key_down (const Keys key) const noexcept
 See if a key is being held down.
SDL_Scancode get_scancode (const Keys key, const KeyMods modifier=KeyMods::MOD_NONE) const noexcept
 Get key scancode.
Public Member Functions inherited from galaxy::WindowBindable
virtual ~WindowBindable () noexcept
 Virtual destructor.

Private Member Functions

 Keyboard (Keyboard &&)=delete
 Move constructor.
Keyboard & operator= (Keyboard &&)=delete
 Move assignment operator.
 Keyboard (const Keyboard &)=delete
 Copy constructor.
Keyboard & operator= (const Keyboard &)=delete
 Copy assignment operator.

Additional Inherited Members

Protected Member Functions inherited from galaxy::WindowBindable
 WindowBindable () noexcept
 Constructor.
 WindowBindable (WindowBindable &&) noexcept
 Move constructor.
virtual WindowBindable & operator= (WindowBindable &&) noexcept
 Move assignment operator.
 WindowBindable (const WindowBindable &) noexcept
 Copy constructor.
virtual WindowBindable & operator= (const WindowBindable &) noexcept
 Copy assignment operator.
void bind_window () noexcept
 Bind SDL3 window to this object.
Protected Attributes inherited from galaxy::WindowBindable
SDL_Window * m_window
 Pointer to SDL_Window handle.

Detailed Description

Physical keyboard device and state management.

Definition at line 23 of file Keyboard.hpp.

Constructor & Destructor Documentation

◆ Keyboard() [1/3]

galaxy::Keyboard::Keyboard ( )
noexcept

Constructor.

Definition at line 12 of file Keyboard.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~Keyboard()

galaxy::Keyboard::~Keyboard ( )
noexcept

Destructor.

Definition at line 17 of file Keyboard.cpp.

◆ Keyboard() [2/3]

galaxy::Keyboard::Keyboard ( Keyboard && )
privatedelete

Move constructor.

Here is the call graph for this function:

◆ Keyboard() [3/3]

galaxy::Keyboard::Keyboard ( const Keyboard & )
privatedelete

Copy constructor.

Here is the call graph for this function:

Member Function Documentation

◆ begin_text_input()

void galaxy::Keyboard::begin_text_input ( const SDL_TextInputType input_type,
const SDL_Capitalization capitals,
const bool multiline ) const
noexcept

Enable window to begin processing text input.

Prevents normal key input until disabled. Triggers SDL_EVENT_TEXT_INPUT and SDL_EVENT_TEXT_EDITING.

Parameters
input_typeAn SDL_TextInputType value that describes text being input.
capitalsAn SDL_Capitalization value that describes how text should be capitalized.
multilineTrue if multiple lines of text are allowed.

Definition at line 21 of file Keyboard.cpp.

Here is the caller graph for this function:

◆ is_text_input_active()

bool galaxy::Keyboard::is_text_input_active ( ) const
nodiscardnoexcept

Is text input active?

Returns
True if in text input mode.

Definition at line 36 of file Keyboard.cpp.

Here is the caller graph for this function:

◆ end_text_input()

void galaxy::Keyboard::end_text_input ( ) const
noexcept

Disable text input.

Definition at line 41 of file Keyboard.cpp.

Here is the caller graph for this function:

◆ clear_state()

void galaxy::Keyboard::clear_state ( ) const
noexcept

Will clear any existing keyboard state.

Definition at line 46 of file Keyboard.cpp.

Here is the caller graph for this function:

◆ has_keyboard()

bool galaxy::Keyboard::has_keyboard ( ) const
nodiscardnoexcept

Check if there is a keyboard connected.

Returns
True if there is a keyboard connected.

Definition at line 51 of file Keyboard.cpp.

Here is the caller graph for this function:

◆ has_onscreen_keyboard()

bool galaxy::Keyboard::has_onscreen_keyboard ( ) const
nodiscardnoexcept

Check if an onscreen keyboard is supported.

Returns
True if supported.

Definition at line 56 of file Keyboard.cpp.

Here is the caller graph for this function:

◆ onscreen_keyboard_active()

bool galaxy::Keyboard::onscreen_keyboard_active ( ) const
nodiscardnoexcept

Check if onscreen keyboard is shown.

Returns
True if onscreen keyboard is active.

Definition at line 61 of file Keyboard.cpp.

Here is the caller graph for this function:

◆ is_key_mod_down()

bool galaxy::Keyboard::is_key_mod_down ( const KeyMods modifier) const
nodiscardnoexcept

See if a key mod is being held down.

Parameters
modifierKeymod to check.
Returns
True if keymod is currently down.

Definition at line 66 of file Keyboard.cpp.

Here is the caller graph for this function:

◆ is_key_down()

bool galaxy::Keyboard::is_key_down ( const Keys key) const
nodiscardnoexcept

See if a key is being held down.

Parameters
keyKey to check.
Returns
True if key is currently down.

Definition at line 72 of file Keyboard.cpp.

Here is the caller graph for this function:

◆ get_scancode()

SDL_Scancode galaxy::Keyboard::get_scancode ( const Keys key,
const KeyMods modifier = KeyMods::MOD_NONE ) const
nodiscardnoexcept

Get key scancode.

Parameters
keyKey to query.
modifierKeymod to check.
Returns
Platform-specific scancode of a key.

Definition at line 78 of file Keyboard.cpp.

Here is the caller graph for this function:

◆ operator=() [1/2]

Keyboard & galaxy::Keyboard::operator= ( Keyboard && )
privatedelete

Move assignment operator.

Here is the call graph for this function:

◆ operator=() [2/2]

Keyboard & galaxy::Keyboard::operator= ( const Keyboard & )
privatedelete

Copy assignment operator.

Here is the call graph for this function:

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