11#include <aegis2d/ui/export.hpp>
26 enum class Kind : std::uint8_t {
97 explicit Console(std::size_t capacity = 500);
100 static constexpr std::size_t history_capacity = 100;
113 [[nodiscard]]
bool open() const noexcept;
117 void set_open(
bool open) noexcept;
126 bool update(const platform::Keyboard& keyboard, const platform::TextInput& input);
134 core::CommandResult submit(
std::string_view line);
140 [[nodiscard]]
std::span<const
std::
string> history() const noexcept;
145 void recall_previous();
164 void clear() noexcept;
168 [[nodiscard]] const
std::
string& input() const noexcept;
172 void set_input(
std::string_view text);
180 [[nodiscard]]
std::
size_t scroll() const noexcept;
184 void scroll_by(
std::ptrdiff_t lines) noexcept;
194 void draw(render::IRenderer& renderer, const render::BitmapFont& font,
Vec2 screen,
199 std::vector<ConsoleLine> lines_;
200 std::size_t capacity_;
202 std::vector<std::string> history_;
203 std::optional<std::size_t> recalled_;
205 std::size_t scroll_ = 0;
Text drawn with a bitmap font, through the sprite batcher.
The commands a console runs: each has a name, its arguments and a help.
Definition commands.hpp:140
The in-game console: the key under Escape opens it over the game, a command typed on its input line r...
Definition console.hpp:88
Console(const Console &)=delete
Console(std::size_t capacity=500)
Closed console, with help and clear.
core::Commands & commands() noexcept
Commands the console runs.
Console & operator=(const Console &)=delete
Console & operator=(Console &&)=delete
Console(Console &&)=delete
RGBA color used by the renderer.
Console commands: named actions with typed arguments and a help, run from a line.
Keyboard keys, their names, and the state of the keyboard during a frame.
Vector and matrix types of the engine (GLM behind engine names).
constexpr Color rgb(std::uint32_t hex, float alpha=1.0F) noexcept
Color from its hexadecimal sRGB code, as design tools and palettes give it.
Definition color.hpp:25
Menus and forms: widgets and their focus, moved by keyboard, gamepad and mouse (client only).
Definition console.hpp:21
glm::vec2 Vec2
2D vector of floats: positions, velocities, sizes (glm::vec2).
Definition math.hpp:19
Definition endpoint.hpp:85
Backend-independent renderer interface and the sprite it draws.
RGBA color with components in [0, 1].
Definition color.hpp:10
A line of the console's output.
Definition console.hpp:24
Kind
What the line is.
Definition console.hpp:26
@ Output
What a command showed.
@ Input
A line typed and run, echoed after the prompt.
@ Error
Why a line did not run.
Kind kind
Its kind, which picks its color.
Definition console.hpp:37
std::string text
Its text, without a line break.
Definition console.hpp:35
Where and how the console is drawn.
Definition console.hpp:41
render::Color input
Color of the input line and of the lines typed.
Definition console.hpp:55
float height
Part of the screen's height the console covers, from the top.
Definition console.hpp:43
float text_scale
Scale of the text (render::TextStyle::scale).
Definition console.hpp:45
std::int32_t layer
Layer of the panel; the text is drawn one layer above.
Definition console.hpp:49
render::Color error
Color of the errors, told from the others with any color vision.
Definition console.hpp:57
float margin
Space between the edges of the panel and the text, in logical pixels.
Definition console.hpp:47
render::Color text
Color of the output.
Definition console.hpp:53
render::Color panel
Color of the panel behind.
Definition console.hpp:51
UTF-8 text typed during a frame, following the user's keyboard layout.