UTF-8 text typed during a frame, following the user's keyboard layout.
More...
#include <aegis2d/platform/text_input.hpp>
|
| void | begin_frame () noexcept |
| | Starts a frame: forgets the text of the previous one.
|
| |
| void | set_active (bool active) noexcept |
| | Turns the collection on or off; turning it off drops the frame's text.
|
| |
| bool | active () const noexcept |
| | Tells whether typed text is collected.
|
| |
| void | add (std::string_view utf8) |
| | Appends text typed during the frame; ignored while inactive.
|
| |
| const std::string & | text () const noexcept |
| | Text typed during the frame, in the order it was typed.
|
| |
UTF-8 text typed during a frame, following the user's keyboard layout.
The window feeds it in Window::poll_events(), which starts a new frame first: text() is what was typed since the last poll. Text events carry the characters the user's layout produces, Shift, AltGr and dead keys applied, so an address typed on an AZERTY keyboard has its own punctuation; raw Keys name physical keys and are for actions, not for typing. Editing keys (Backspace, Enter, the arrows) are not text: read them on the Keyboard. Nothing is collected until text input is started (Window::set_text_input()).
◆ active()
| bool aegis2d::platform::TextInput::active |
( |
| ) |
const |
|
noexcept |
Tells whether typed text is collected.
- Returns
false by default.
◆ add()
| void aegis2d::platform::TextInput::add |
( |
std::string_view |
utf8 | ) |
|
Appends text typed during the frame; ignored while inactive.
- Parameters
-
| utf8 | UTF-8 text of a text event, appended whole. |
◆ begin_frame()
| void aegis2d::platform::TextInput::begin_frame |
( |
| ) |
|
|
noexcept |
Starts a frame: forgets the text of the previous one.
◆ set_active()
| void aegis2d::platform::TextInput::set_active |
( |
bool |
active | ) |
|
|
noexcept |
Turns the collection on or off; turning it off drops the frame's text.
- Parameters
-
| active | true while something on screen takes text, such as a focused field. |
◆ text()
| const std::string & aegis2d::platform::TextInput::text |
( |
| ) |
const |
|
noexcept |
Text typed during the frame, in the order it was typed.
- Returns
- UTF-8 text; empty while inactive or when nothing was typed.
The documentation for this class was generated from the following file: