ge211
2021.5.1
A student game engine
|
|
3 #include "ge211_forward.hxx"
4 #include "ge211_error.hxx"
5 #include "ge211_noexcept.hxx"
43 bool map_button(uint8_t, Mouse_button&) NOEXCEPT;
46 static char32_t
const lowest_unicode_surrogate = 0xD800;
47 static char32_t
const highest_unicode_surrogate = 0xDFFF;
48 static char32_t
const highest_unicode_code_point = 0x10FFFF;
51 inline bool is_valid_unicode(char32_t code)
53 return code < lowest_unicode_surrogate ||
54 (code > highest_unicode_surrogate &&
55 code <= highest_unicode_code_point);
143 if (detail::is_valid_unicode(c))
209 char32_t
code() const NOEXCEPT {
return code_; }
231 explicit Key(char32_t c) NOEXCEPT
236 friend class detail::Engine;
237 explicit Key(SDL_KeyboardEvent
const&) NOEXCEPT;
246 return a.type() == b.type() && a.code() == b.code();
std::string as_text() const
Returns a representation of the key's code as a std::string.
bool is_textual() const
Does the key represent printable text? This is true for some but not all Type::code keys.
Mouse_button
A representation of a mouse button.
static Key control()
Constructs the control key.
static Key command()
Constructs the command (or meta) key.
static Key alt()
Constructs the alt (or option) key.
static Key other()
Constructs an invalid or unknown key.
static Key down()
Constructs the down arrow key.
Type
The possible types of keys.
Represents a key on the keyboard.
@ control
The control key.
The game engine namespace.
@ command
The command or meta key.
An exception that indicates that a logic error was performed by the client.
@ down
The down arrow key.
@ left
The left arrow key.
static Key up()
Constructs the up arrow key.
static Key right()
Constructs the right arrow key.
@ other
Any other, unknown or invalid key.
@ code
Indicates a key with an Unicode value, which can be gotten with Key::code() const.
bool operator==(Key a, Key b)
Equality for keys.
static Key code(char32_t c)
Constructs a key with the given Unicode code point code.
char32_t code() const
The Unicode code point of the key, if it has one.
std::ostream & operator<<(std::ostream &, Mouse_button)
Prints a Mouse_button on a std::ostream.
static Key shift()
Constructs the shift key.
static Key left()
Constructs the left arrow key.
@ right
The right arrow key.
Type type() const
The type of the key.
@ right
The secondary mouse button.
Key()
Constructs the empty key, with type Key::Type::other.
bool operator!=(Key a, Key b)
Disequality for keys.
@ left
The primary mouse button. This is an ordinary click.
@ alt
The alt or option key.