Documentation Index
Fetch the complete documentation index at: https://mintlify.com/adi3120/Fazen2d/llms.txt
Use this file to discover all available pages before exploring further.
Text writes a std::wstring into consecutive console cells starting at (x, y), setting each cell’s Char.UnicodeChar and Attributes fields directly in the ConsoleHandler back-buffer. Unlike the geometry primitives, Text does not go through Point::draw() — it writes to the buffer directly in a tight loop, so there is no built-in bounds check. It provides two construction paths: a wide-string literal overload and an integer overload that converts the number to a wstring via std::wostringstream, making it convenient for live score or counter displays.
Header
Text.h pulls in <sstream> and <string> and brings std::wstring into scope.
Constructors
From a wide string
Starting column for the first character of the string.
Row at which the string is rendered. All characters share the same row.
The wide-character string to display. Use
L"..." wide string literals. Supports any Unicode code points representable as wchar_t.A
ConsoleColor enum value applied to every character in the string (e.g. whiteF, yellowF).From an integer
Starting column for the rendered number string.
Row at which the number is rendered.
Integer value converted to a
wstring via std::wostringstream and stored as the internal string. Use setValue(int) to update it each frame.A
ConsoleColor enum value applied to every digit character.Methods
| Method | Returns | Description |
|---|---|---|
draw() | void | Iterates over the internal wstring, writing each wchar_t and the color attribute into consecutive back-buffer cells at row y starting from column x. |
setValue(wstring s) | void | Replaces the displayed string with a new wide-string value. |
setValue(int b) | void | Converts b to a wstring via std::wostringstream and replaces the displayed string. Useful for live integer counters. |
setPosX(float) / getPosX() | void / float | Starting column of the text. |
setPosY(float) / getPosY() | void / float | Row of the text. |
setColor(short) / getColor() | void / short | Color attribute applied to every character. |
getValue() | wstring | Returns the current wstring value stored in the object. |
Example
Text::draw() writes directly to the back-buffer without a bounds check. If x + value.length() exceeds ConsoleHandler::GetConsoleWidth(), the write wraps into the next row or beyond the buffer end, causing visual corruption or a buffer overrun. Always verify that (int)x + (int)value.size() <= ConsoleHandler::GetConsoleWidth() before drawing near the right edge.