6#include <foundation/Math/Box.h>
7#include <foundation/String/String.h>
8#include <foundation/math/Int2.h>
33 TerminalStyle() =
default;
35 TerminalStyle(Color foreground, Color background) :
Foreground(foreground),
Background(background) {}
42 struct FramebufferEntry
75 FramebufferEntry(
Int2 position, TerminalStyle style,
wchar_t character) :
88 friend class TerminalImpl;
100 std::vector<FramebufferEntry> m_Entries;
109 Framebuffer() =
default;
154 std::stack<TerminalStyle> m_Stack;
157 StyleStack() =
default;
202 m_StyleStack.Push(m_Style);
205 ~ScopeStyle() { m_StyleStack.Pop(); }
238 inline static Int2 m_Size;
264 static int32
Getch();
Represents a set of pixels in array with size of terminal.
Definition Terminal.h:86
void Put(Int2 position, TerminalStyle style, char character)
Puts UTF-8 character to given size and applies given style.
Definition TerminalBase.cpp:20
void Clear()
Sets all pixels to black foreground, black background and empty character.
Definition TerminalBase.cpp:11
Int2 GetSize() const
Returns size of framebuffer.
Definition TerminalBase.cpp:41
void Resize(const Int2 &size)
Sets size to given size and resizes array to m_Size.X * m_Size.Y.
Definition TerminalBase.cpp:13
Stack of terminal styles.
Definition Terminal.h:148
void Pop()
Pops style at the top.
Definition TerminalBase.cpp:45
void Push(const TerminalStyle &style)
Pushes given style to the top.
Definition TerminalBase.cpp:43
TerminalStyle & Peek()
Returns style at the top of the stack.
Definition TerminalBase.cpp:47
Platform-specific terminal functions implemented per platform.
Definition Terminal.h:232
static Int2 GetSize()
Returns size of the terminal. X is total terminal row, y is columns.
Definition TerminalImpl.cpp:53
static int32 Getch()
Returns pressed key. Blocks until any key is pressed.
Definition TerminalImpl.cpp:83
static void DestroyBuffers()
Destroys platform framebuffer.
Definition TerminalImpl.cpp:107
static void ForceSizeUpdate()
Updates size of the terminal.
Definition TerminalImpl.cpp:96
static void Draw(const Int2 &size, Framebuffer &framebuffer)
Puts pixel from framebuffer to the terminal.
Definition TerminalImpl.cpp:55
static void Update(const Int2 &size)
Resizes platform framebuffer to given size.
Definition TerminalImpl.cpp:81
static void WriteDebug(const String &message)
Writes message to the attached debugger.
Definition TerminalImpl.cpp:105
Represents a mutable sequence of characters, providing various member functions for string manipulati...
Definition String.h:16
Represents framebuffer single glyph.
Definition Terminal.h:43
TerminalStyle Style
Glyph terminal style.
Definition Terminal.h:48
Int2 Position
Position of glyph (X is row, Y is column)
Definition Terminal.h:66
wchar_t UnicodeCharacter
Glyph encoded in UTF-16. Not used when UTF-8 character is used.
Definition Terminal.h:60
char Character
Glyph encoded in UTF-8. Not used when UTF-16 character is used.
Definition Terminal.h:54
Represents a major terminal informations.
Definition Terminal.h:213
int32 Height
Columns of the terminal.
Definition Terminal.h:224
int32 Width
Rows of the terminal.
Definition Terminal.h:218
Represents terminal text style, described by background and foreground color.
Definition Terminal.h:20
Color Foreground
Text foreground.
Definition Terminal.h:25
Color Background
Text background.
Definition Terminal.h:31
Represents a two component vector. Components are 32-bit and they are signed.
Definition Int2.h:11