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.

Fazen2d is a C++ graphics library that turns the Windows console into a 2D drawing surface. It provides geometry primitives (points, lines, boxes, circles, and text), a double-buffered renderer for flicker-free output, keyboard and mouse input, frame timing, and coordinate management — all built exclusively on the Windows API.

Quickstart

Draw your first shapes in under five minutes with a minimal render loop.

Installation & Build

Requirements, compiler setup, and building with Make or manual g++.

Core Concepts

Understand the engine architecture, frame loop, and coordinate system.

API Reference

Complete reference for every class, method, and color constant.

How Fazen2d Works

Fazen2d uses a double-buffering strategy: every frame writes shapes into an off-screen CHAR_INFO buffer, then flushes it to the visible console in a single atomic WriteConsoleOutputW call. This eliminates flicker and keeps your rendering code simple.
1

Initialize the engine

Create a Fazen object with your desired console dimensions. This sets up the console buffer, font, and all subsystems.
#include "include/headers/Fazen.h"
Fazen game(100, 100);
2

Create shapes

Instantiate geometry primitives — Box, Line, Circle, Point, or Text — with position, size, and color.
Box    box(10, 5, 20, 10, redF);
Circle circle(50, 50, 15, greenF);
Text   label(5, 2, L"Hello, Fazen2d!", whiteF);
3

Run the render loop

Each frame: clear the background, draw shapes into the buffer, then flush to the console.
while (!game.keyboardHandler.CheckForUserExit()) {
    game.graphics.background(whiteB);
    game.graphics.draw(box);
    game.graphics.draw(circle);
    game.graphics.draw(label);
    game.graphics.display();
}
4

Handle input

Poll keyboard and mouse state inside the loop to drive interactivity.
if (game.keyboardHandler.IsKeyPressed(VK_RIGHT))
    box.translate(1.0f, 0.0f);
game.mouseHandler.UpdateMouseState();
if (game.mouseHandler.IsLeftMouseClicked())
    circle.setCenterX(game.mouseHandler.GetMouseX());

Key Features

Double-Buffered Rendering

Off-screen CHAR_INFO buffer flushed atomically via WriteConsoleOutputW — no flicker, no partial updates.

Geometry Primitives

Point, Line (Bresenham), Box, Circle, and Unicode Text — each with draw() and translate().

Keyboard & Mouse Input

GetAsyncKeyState-backed key polling and screen-to-console mouse coordinate mapping.

Frame Timing

TimeManager measures elapsed time between frames for smooth, delta-time based animation.

Color System

ConsoleColor enum and Color class cover all Windows console foreground and background attributes.

Zero External Dependencies

Built entirely on windows.h — no third-party libraries required.

Build docs developers (and LLMs) love