3 #include "ge211_forward.h" 4 #include "ge211_error.h" 35 bool map_button(uint8_t, Mouse_button&) noexcept;
38 static char32_t
const lowest_unicode_surrogate = 0xD800;
39 static char32_t
const highest_unicode_surrogate = 0xDFFF;
40 static char32_t
const highest_unicode_code_point = 0x10FFFF;
43 inline bool is_valid_unicode(char32_t code)
45 return code < lowest_unicode_surrogate ||
46 (code > highest_unicode_surrogate &&
47 code <= highest_unicode_code_point);
135 if (detail::is_valid_unicode(c))
201 char32_t
code() const noexcept {
return code_; }
223 explicit Key(char32_t c) noexcept
228 friend detail::Engine;
229 explicit Key(SDL_KeyboardEvent
const&) noexcept;
238 return a.type() == b.type() && a.code() == b.code();
Mouse_button
A representation of a mouse button.
Represents a key on the keyboard.
static Key shift() noexcept
Constructs the shift key.
std::string as_text() const
Returns a representation of the key's code as a std::string.
Type
The possible types of keys.
static Key command() noexcept
Constructs the command (or meta) key.
The game engine namespace.
bool operator!=(Key a, Key b) noexcept
Disequality for keys.
bool is_textual() const noexcept
Does the key represent printable text? This is true for some but not all Type::code keys...
Key() noexcept
Constructs the empty key, with type Key::Type::other.
static Key left() noexcept
Constructs the left arrow key.
bool operator==(Key a, Key b) noexcept
Equality for keys.
Any other, unknown or invalid key.
std::ostream & operator<<(std::ostream &os, Mouse_button button)
Prints a Mouse_button on a std::ostream.
char32_t code() const noexcept
The Unicode code point of the key, if it has one.
Indicates a key with an Unicode value, which can be gotten with Key::code() const.
static Key control() noexcept
Constructs the control key.
static Key code(char32_t c)
Constructs a key with the given Unicode code point code.
static Key up() noexcept
Constructs the up arrow key.
static Key down() noexcept
Constructs the down arrow key.
static Key other() noexcept
Constructs an invalid or unknown key.
An exception that indicates that a logic error was performed by the client.
static Key alt() noexcept
Constructs the alt (or option) key.
static Key right() noexcept
Constructs the right arrow key.
Type type() const noexcept
The type of the key.