Every time Terminality redraws a widget it callsDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Rikitav/Terminality/llms.txt
Use this file to discover all available pages before exploring further.
RenderOverride(RenderContext& context) with a RenderContext scoped to the widget’s allocated rectangle. The context clips all drawing to that region and writes into a shared RenderBuffer. When the frame is done, the buffer diffs itself against the previous snapshot and flushes only changed cells to the terminal. This page documents the full surface of RenderContext, the RenderStream fluent helper, and the RenderBuffer that backs them.
Class: RenderContext
A RenderContext is created by the engine and passed to RenderOverride. You do not instantiate it directly in application code. Every drawing method coordinates through the owning RenderBuffer using absolute buffer positions derived from the widget’s Rect.
Constructor (internal)
targetRect defines the clipping region in buffer coordinates.
CreateInner
RenderContext clipped to targetRect within the current context’s bounds. Useful when a composite widget wants to render sub-sections with tighter clipping. The inner rect is clamped so it never escapes the outer bounds.
Target rectangle in the parent context’s local coordinate space.
A new context clipped to the intersection of
targetRect and the current context.ContextRect
The absolute
Rect this context draws into.SetCell (two overloads)
(x, y). Coordinates outside the clipping rect are silently ignored. The second overload creates a CellInfo inline.
Column in local (context-relative) coordinates.
Row in local coordinates.
The cell state or character to write.
GetCell
CellInfo (space, white on black) for out-of-bounds positions.
The cell at
(x, y), or an empty cell if the coordinates are out of range.BeginText
RenderStream anchored at startPos. The stream inherits this context and allows chaining color changes and text output with <<. See RenderStream below.
Starting cursor position within the context’s local coordinate space.
A stream object bound to this context.
RenderRaw
point, without color or encoding conversion. Intended for pre-formatted ANSI escape sequences or character art.
RenderText (four overloads)
point with the given foreground and background colors. When wrap is true, text that overflows the width wraps to the next row. All overloads converge on the std::wstring implementation.
Top-left origin of the text in local coordinates.
The text content to render.
Foreground (character) color.
Background color behind the text.
When
true, text wraps to subsequent rows instead of clipping at the right edge.RenderRectangle (multiple overloads)
style. The default style fills with #. A RectangleStyle is a function pointer wchar_t(*)(const Point&, const Size&) that receives each cell’s local position and the rectangle’s size; return L'\0' to skip a cell.
RenderLine (multiple overloads)
─ for horizontal and │ for vertical movement. A VectorStyle is wchar_t(*)(const Point&, const Vector&); receive the current point and the full vector, return L'\0' to skip. direction 0 means horizontal, non-zero means vertical.
Class: RenderStream
RenderStream is a fluent, stream-style wrapper around RenderContext::RenderText. Obtain one by calling context.BeginText(). The stream tracks the current cursor position and active colors, advancing the cursor after each text write.
Positioning with <<
point without drawing anything.
Color with <<
SetFore, SetBack, and SetColor helpers to create a RenderStreamColor:
Text output with <<
Manipulators
endl manipulator calls NewLine():
NewLine
Complete RenderOverride example
The MessageBubble widget from the test application demonstrates typical RenderStream usage: a single BeginText() call followed by chained color and text writes, with focused_ driving the color choice.
Class: RenderBuffer
RenderBuffer is the backing store for the terminal display. It holds two cell grids — the current frame and the previous snapshot — and computes the dirty region between them so DiffRender only writes changed cells to stdout.
You do not normally interact with RenderBuffer directly; RenderContext writes into it on your behalf. It is documented here for completeness and for use in custom engine extensions.
Constructor
Initial column count. Must not exceed
MAX_WIDTH (512).Initial row count. Must not exceed
MAX_HEIGHT (256).Dimensions
Resize is called automatically by the engine when the terminal window size changes (after the debounce timer fires on ResizeFinishedEvent).
Cell access
RenderContext uses these internally.
Clear
cell (default: space, white on black).
Dirty-region tracking
Snapshot copies the current buffer into the snapshot grid. DiffRender compares the current buffer to the snapshot and emits ANSI escape sequences only for cells that differ. BulkRender unconditionally emits all cells — used on first draw or after a resize. The engine calls these automatically each frame; applications do not need to call them.
Constants
| Constant | Value | Description |
|---|---|---|
MAX_WIDTH | 512 | Maximum column count |
MAX_HEIGHT | 256 | Maximum row count |
CellInfo struct
A single terminal cell: character, foreground color, and background color.
Related
Color—Color::WHITE,Color::CYAN, and all named color valuesGeometry—Point,Size,Rect,Vectortypes used throughoutDispatchTimer— drive per-frame animations by mutating properties fromTickEvent