Fazen2d is organized into six subsystems wired together by a single aggregator class,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.
Fazen. Including Fazen.h is all user code needs — it acts as an umbrella header that pulls in every subsystem’s declaration, so you get console management, rendering, geometry primitives, input, and utilities from one #include "include/headers/Fazen.h" line.
Subsystem Map
| Subsystem | Classes | Responsibility |
|---|---|---|
| Core | Fazen | Aggregates all subsystems into one engine object |
| Console Management | ConsoleHandler, Colors | Buffer allocation, handle setup, font configuration, and color constants |
| Rendering | GraphicsRenderer | Buffer clearing, draw dispatch, and atomic flush to the console |
| Geometry | Shape, Point, Line, Box, Circle, Text | Drawable primitives; each implements draw() and translate() |
| Input | KeyboardHandler, MouseHandler | Key state queries and mouse position tracking |
| Utilities | StateManager, TimeManager, MathUtils | Global coordinate offset, frame timing, and numeric mapping |
Class Dependency Flow
Fazen is the root of the dependency graph. Its constructor instantiates ConsoleHandler first, allocating the CHAR_INFO back-buffer and configuring the Windows console. GraphicsRenderer comes next and depends on ConsoleHandler’s static methods to read the buffer pointer, buffer dimensions, and output handle. KeyboardHandler, MouseHandler, and TimeManager are then initialized; MouseHandler depends on both ConsoleHandler (for font dimensions and window position) and MathUtils (for coordinate mapping). Shape subclasses — Point, Line, Box, Circle, and Text — depend on ConsoleHandler at draw time, calling ConsoleHandler::GetBuffScreen() and ConsoleHandler::GetConsoleWidth() to index and write into the buffer. StateManager holds purely static state and has no constructor dependency on any other class.
The Fazen Aggregator
Fazen declares all five public subsystem members. Constructing it with a width and height is the only initialization call your application needs:
| Member | Type | Purpose |
|---|---|---|
console | ConsoleHandler | Owns the CHAR_INFO buffer and all Windows console handles |
graphics | GraphicsRenderer | Exposes background(), draw(), and display() |
keyboardHandler | KeyboardHandler | Wraps GetAsyncKeyState; provides IsKeyPressed() and CheckForUserExit() |
timer | TimeManager | Measures elapsed time between frames via std::chrono |
mouseHandler | MouseHandler | Maps raw cursor pixel positions to console cell coordinates |
Fazen.h also forward-includes all geometry and color headers, so shapes like Box and color constants like redF are available everywhere Fazen.h is included:
File Layout
include/headers/ is paired with a same-name .cpp under include/. For example, GraphicsRenderer.h is implemented by include/GraphicsRenderer.cpp, which opens with #include "headers/GraphicsRenderer.h". The Makefile uses a wildcard pattern rule to compile every .cpp in include/ automatically:
Extension Points
Adding a new drawable primitive to Fazen2d requires four steps:- Create the header — add
include/headers/YourShape.h. Derive your class fromShapeand declare the constructor,void draw() override, andvoid translate(float dx, float dy) override. - Implement the class — add
include/YourShape.cpp. Insidedraw(), callConsoleHandler::GetBuffScreen()to obtain the buffer pointer and write characters using thex + ConsoleHandler::GetConsoleWidth() * yindex formula. - Include it where needed — add
#include "YourShape.h"toFazen.h(or directly in your application file) so the new type is visible. - Build — run
make. The Makefile wildcard picks upinclude/YourShape.cppautomatically; no Makefile edits are required.
Shape base interface enforces the contract:
GraphicsRenderer::draw(Shape& s) accepts any Shape reference, your new primitive integrates into the existing frame loop without any changes to the renderer.