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
Keyboard.hpp
Go to the documentation of this file.
1
7
8#ifndef GALAXY_INPUT_KEYBOARD_HPP_
9#define GALAXY_INPUT_KEYBOARD_HPP_
10
11#include <string>
12
13#include <SDL3/SDL_keyboard.h>
14
15#include "galaxy/input/Keys.hpp"
17
18namespace galaxy
19{
23 class Keyboard final : public WindowBindable
24 {
25 public:
29 Keyboard() noexcept;
30
34 ~Keyboard() noexcept;
35
45 void begin_text_input(const SDL_TextInputType input_type, const SDL_Capitalization capitals, const bool multiline) const noexcept;
46
52 [[nodiscard]]
53 bool is_text_input_active() const noexcept;
54
58 void end_text_input() const noexcept;
59
63 void clear_state() const noexcept;
64
70 [[nodiscard]]
71 bool has_keyboard() const noexcept;
72
78 [[nodiscard]]
79 bool has_onscreen_keyboard() const noexcept;
80
86 [[nodiscard]]
87 bool onscreen_keyboard_active() const noexcept;
88
96 [[nodiscard]]
97 bool is_key_mod_down(const KeyMods modifier) const noexcept;
98
106 [[nodiscard]]
107 bool is_key_down(const Keys key) const noexcept;
108
117 [[nodiscard]]
118 SDL_Scancode get_scancode(const Keys key, const KeyMods modifier = KeyMods::MOD_NONE) const noexcept;
119
120 private:
124 Keyboard(Keyboard&&) = delete;
125
130
134 Keyboard(const Keyboard&) = delete;
135
139 Keyboard& operator=(const Keyboard&) = delete;
140 };
141} // namespace galaxy
142
143#endif
Keyboard() noexcept
Constructor.
Definition Keyboard.cpp:12
void clear_state() const noexcept
Will clear any existing keyboard state.
Definition Keyboard.cpp:46
void end_text_input() const noexcept
Disable text input.
Definition Keyboard.cpp:41
bool onscreen_keyboard_active() const noexcept
Check if onscreen keyboard is shown.
Definition Keyboard.cpp:61
Keyboard & operator=(const Keyboard &)=delete
Copy assignment operator.
SDL_Scancode get_scancode(const Keys key, const KeyMods modifier=KeyMods::MOD_NONE) const noexcept
Get key scancode.
Definition Keyboard.cpp:78
bool is_key_mod_down(const KeyMods modifier) const noexcept
See if a key mod is being held down.
Definition Keyboard.cpp:66
Keyboard(Keyboard &&)=delete
Move constructor.
Keyboard & operator=(Keyboard &&)=delete
Move assignment operator.
bool has_keyboard() const noexcept
Check if there is a keyboard connected.
Definition Keyboard.cpp:51
bool is_text_input_active() const noexcept
Is text input active?
Definition Keyboard.cpp:36
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.
Definition Keyboard.cpp:21
Keyboard(const Keyboard &)=delete
Copy constructor.
bool is_key_down(const Keys key) const noexcept
See if a key is being held down.
Definition Keyboard.cpp:72
bool has_onscreen_keyboard() const noexcept
Check if an onscreen keyboard is supported.
Definition Keyboard.cpp:56
WindowBindable() noexcept
Constructor.
Tag.cpp galaxy.
Definition Tag.cpp:13
Keys
Enum class representing keys.
Definition Keys.hpp:23
KeyMods
Enum class for key modifiers.
Definition Keys.hpp:286