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.

In this quickstart you’ll get Fazen2d running on your machine, compile the project with a single command, and have an animated program drawing a red box, a blue line, and a green circle on a white console background — all exitable with the ESC key. No external libraries, no package manager, just a compiler and make.

Prerequisites

Before you begin, make sure you have the following available on your Windows machine:
  • Windows 10 or later — Fazen2d uses Win32 Console APIs that require a modern Windows console host.
  • g++ with C++11 support — available via MinGW or MSYS2. The Makefile compiles with g++ -std=c++11.
  • GNU Make — included with MinGW/MSYS2, or installable via Chocolatey (choco install make). If you prefer, you can compile manually without make (see Step 1 below).

Step 1: Clone, Build, and Run

1

Clone the repository

Open a Windows command prompt or Git Bash in the directory where you want to place the project, then run:
git clone https://github.com/adi3120/Fazen2d.git && cd Fazen2d
This downloads the full source tree, including all headers under include/headers/, all implementation files under include/, main.cpp, and the Makefile.
2

Build with Make

From inside the Fazen2d directory, run:
make
The Makefile compiles every .cpp file found under include/ (one per subsystem — Box.cpp, Circle.cpp, ConsoleHandler.cpp, and so on) together with main.cpp, all with the -std=c++11 flag, and links the resulting object files into an executable named a in the project root.If you don’t have make installed, you can compile manually:
g++ -std=c++11 include/*.cpp main.cpp -o a
3

Run the demo

Launch the built executable from the same console window:
.\a
On some MinGW setups the output file may be named a.exe; in that case run a.exe directly. The console buffer will initialize and the animation will begin immediately. Press ESC to exit cleanly.

Your First Program

The code below is a lightly annotated version of main.cpp — the canonical Fazen2d demo. Every Fazen2d program follows the same three-step loop inside while (true): clear → draw → display.
main.cpp
#include "include/headers/Fazen.h"

int main() {
    Fazen game(100, 100);          // Initialize 100x100 console buffer

    Box    box(0, 20, 20, 60, redF);
    Line   line(0, 0, 10, 10, blueF);
    Circle circle(20, 20, 10, greenF);

    while (true) {
        game.graphics.background(whiteB);   // Clear to white
        game.graphics.draw(box);
        game.graphics.draw(line);
        game.graphics.draw(circle);

        box.translate(0.01f, 0.01f);        // Animate
        line.translate(0.1f,  0.1f);
        circle.translate(0.1f, 0.1f);

        game.graphics.display();            // Flush buffer

        if (game.keyboardHandler.CheckForUserExit()) break;
    }
}
Here is what each part does:
LineWhat it does
Fazen game(100, 100)Constructs the engine, allocating a CHAR_INFO[100 × 100] back-buffer and configuring the console font and window size via ConsoleHandler.
Box / Line / Circle constructorsCreate shape objects with a position, size or endpoints, and a ConsoleColor constant from Colors.h (redF, blueF, greenF).
game.graphics.background(whiteB)Fills every cell in the back-buffer with a space character at the whiteB (white background) attribute — effectively clearing the screen each frame.
game.graphics.draw(shape)Calls the shape’s draw() override, which writes Unicode characters and color attributes into the back-buffer cells that the shape occupies.
shape.translate(dx, dy)Shifts the shape’s position by (dx, dy) console cells per frame, producing smooth diagonal movement.
game.graphics.display()Flushes the entire back-buffer to the visible console in one call to WriteConsoleOutputW, ensuring a flicker-free update.
game.keyboardHandler.CheckForUserExit()Checks whether the ESC key (VK_ESCAPE) is currently pressed via GetAsyncKeyState; returns true to break the loop and exit.

What You Should See

Once the program is running, the console will show a white background filling the entire window. A red filled rectangle (the Box) glides diagonally down and to the right at a slow pace. A blue diagonal line streaks across the screen moving faster than the box. A green filled circle also travels diagonally, moving at the same speed as the line. All three shapes start in the upper-left region of the buffer and migrate toward the lower-right corner over time. The animation runs continuously at the speed your CPU can drive the render loop. Press ESC at any point to exit the program cleanly.

Next Steps

System Requirements

Review the full list of OS, compiler, and console requirements before deploying Fazen2d in your own project.

Build Guide

Learn how the Makefile works in detail, how to do a manual compilation, and how to integrate Fazen2d source into an existing project.

Frame Loop

Understand the clear–draw–display cycle, double-buffering internals, and how to add frame-rate-independent timing to your loop.

API Reference

Explore the full public API — every class, constructor, method signature, and color constant available in Fazen2d.

Build docs developers (and LLMs) love