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.

Box draws a solid filled rectangle by iterating over the region from (x, y) to (x + width, y + height) and placing a Point at every position inside it. The inner loop steps in increments of 0.1 along both axes so that the rectangle is fully dense regardless of floating-point origins, delegating the actual buffer write and safe-margin check to Point::draw() at each step.
#include "include/headers/Box.h"

Constructor

explicit Box(float x, float y, float width, float height, short color, short character = 0x2588);
x
float
required
Column of the top-left corner of the rectangle.
y
float
required
Row of the top-left corner of the rectangle.
width
float
required
Horizontal extent in console columns. The filled region spans columns x through x + width inclusive.
height
float
required
Vertical extent in console rows. The filled region spans rows y through y + height inclusive.
color
short
required
A ConsoleColor enum value applied uniformly to every cell in the rectangle (e.g. greyF, blueF).
character
short
default:"0x2588"
Unicode code point written into every cell. Defaults to 0x2588 (█) for a solid fill. Supply a different code point for textured or patterned boxes.

Methods

MethodReturnsDescription
draw()voidFills the width × height region by iterating in 0.1-unit steps and placing a Point at each position in the back-buffer.
translate(float dx, float dy)voidMoves the box origin by dx/dy. Applies the offset only if the entire box (origin plus dimensions) remains within console bounds.
setPosX(float) / getPosX()void / floatTop-left corner X.
setPosY(float) / getPosY()void / floatTop-left corner Y.
setWidth(float) / getWidth()void / floatRectangle width in columns.
setHeight(float) / getHeight()void / floatRectangle height in rows.
setColor(short) / getColor()void / floatFill color attribute.
setCharacter(short) / getCharacter()void / floatFill character code point.

Example

#include "include/headers/Fazen.h"

Box wall(0.0f, 0.0f, 5.0f, 40.0f, greyF);     // 5-wide left wall
Box floor(0.0f, 38.0f, 100.0f, 2.0f, greyF);  // 2-tall floor strip

game.graphics.draw(wall);
game.graphics.draw(floor);

// Slide the wall right by one column per frame:
wall.translate(1.0f, 0.0f);
Box applies bounds checking inside translate() — it verifies that both the origin and the far corner (x + width, y + height) remain within the console before moving. However, draw() does not clip to the console boundary itself; out-of-range cells are filtered by Point::draw()’s safe-margin check (x > 1 and x < width - 1). Always keep x >= 0 and x + width <= ConsoleHandler::GetConsoleWidth() to avoid writing to invalid buffer indices.

Build docs developers (and LLMs) love