Skip to main content

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.

Point is the fundamental rendering primitive in Fazen2d. It draws exactly one character cell at position (x, y) in the ConsoleHandler back-buffer using a caller-supplied ConsoleColor and Unicode character code. All other shapes — Line, Box, and Circle — are built internally from individual Point draws, making it the foundation of the entire graphics system.
#include "include/headers/Point.h"

Constructor

explicit Point(float x, float y, short color, short character = 0x2588);
x
float
required
Horizontal position in console columns. Truncated to int on each draw() call. Valid range: 1 < x < ConsoleHandler::GetConsoleWidth() - 1.
y
float
required
Vertical position in console rows. Truncated to int on each draw() call. Valid range: 1 < y < ConsoleHandler::GetConsoleHeight() - 1.
color
short
required
A ConsoleColor enum value (e.g. greenF, redF, whiteF) that sets the Windows console foreground attribute for the cell.
character
short
default:"0x2588"
Unicode code point written into the cell’s Char.UnicodeChar field. The default 0x2588 (█) produces a solid filled block. Pass any valid wchar_t-range code point for custom characters (e.g. 0x2605 for ★).

Methods

MethodReturnsDescription
draw()voidWrites character and color into the back-buffer cell at (int(x), int(y)). Silently skips the draw if x or y falls outside the safe margin (> 1 and < dimension - 1).
translate(float dx, float dy)voidComputes nx = x + dx, ny = y + dy and applies the offset only if the new position is fully within [0, consoleWidth) × [0, consoleHeight). No-ops on out-of-bounds moves.
setPosX(float x)voidSets the X position directly, bypassing bounds checking.
getPosX()floatReturns the current X position.
setPosY(float y)voidSets the Y position directly, bypassing bounds checking.
getPosY()floatReturns the current Y position.
setColor(short color)voidReplaces the color attribute used on the next draw() call.
getColor()floatReturns the current color attribute as a float.
setCharacter(short character)voidReplaces the Unicode character written on the next draw() call.
getCharacter()floatReturns the current character code as a float.

Example

#include "include/headers/Fazen.h"

Point dot(10.0f, 5.0f, greenF);            // green filled square (█) at (10, 5)
Point star(20.0f, 10.0f, yellowF, 0x2605); // yellow ★ at (20, 10)

// Inside the game loop:
game.graphics.draw(dot);
game.graphics.draw(star);

// Move dot one cell to the right each frame:
dot.translate(1.0f, 0.0f);

Build docs developers (and LLMs) love