Aegis2D
Modular C++26 2D game engine for networked games
Loading...
Searching...
No Matches
text_input.hpp
Go to the documentation of this file.
1
3#pragma once
4
5#include <aegis2d/platform/export.hpp>
6
7#include <string>
8#include <string_view>
9
10namespace aegis2d::platform {
11
15AEGIS2D_PLATFORM_EXPORT bool pop_back_utf8(std::string& text) noexcept;
16
25class AEGIS2D_PLATFORM_EXPORT TextInput {
26public:
28 void begin_frame() noexcept;
29
32 void set_active(bool active) noexcept;
33
36 [[nodiscard]] bool active() const noexcept;
37
40 void add(std::string_view utf8);
41
44 [[nodiscard]] const std::string& text() const noexcept;
45
46private:
47 std::string text_;
48 bool active_ = false;
49};
50
51} // namespace aegis2d::platform
UTF-8 text typed during a frame, following the user's keyboard layout.
Definition text_input.hpp:25
void begin_frame() noexcept
Starts a frame: forgets the text of the previous one.
Window and input on top of SDL3, independent of the graphics API (client only).
Definition actions.hpp:19
bool pop_back_utf8(std::string &text) noexcept
Removes the last UTF-8 code point of a string, as Backspace does.
Definition endpoint.hpp:85