Fireset
Loading...
Searching...
No Matches
Render

Basic 2D rendering primitives. More...

Classes

struct  FsQuad
 Quadrilateral primitive. More...
struct  FsTriangle
 Triangle primitive. More...
struct  FsPoint
 Point primitive. More...
struct  FsCircle
 Circle primitive. More...
struct  FsLine
 Line primitive. More...
struct  FsSprite
 Sprite structure. More...

Functions

double fsLookAt (FsVec2 origin, FsVec2 target, FsDirection forward)
 Calculates the angle to face a target position.
void fsDrawPoint (const FsPoint *p, int zindex)
 Draws a pixel.
void fsDrawLine (const FsLine *line, int zindex)
 Draws a line.
void fsDrawTriangle (const FsTriangle *tri, int zindex)
 Draws a triangle.
void fsDrawQuad (const FsQuad *quad, int zindex)
 Draws a quadrilateral.
void fsDrawCircle (const FsCircle *circle, int zindex)
 Draws a circle.
void fsDrawSprite (const FsSprite *sprite, int zindex)
 Draws a 2D sprite.
void fsOrthoSet (int width, int height)
 Sets the orthographic projection.
void fsClear (FsColor color)
 Clears the window.

Detailed Description

Basic 2D rendering primitives.

Function Documentation

◆ fsClear()

void fsClear ( FsColor color)

Clears the window.

Clears the window and OpenGL context using a color.

Parameters
colorClear color.

◆ fsDrawCircle()

void fsDrawCircle ( const FsCircle * circle,
int zindex )

Draws a circle.

Draws a colored circle.

Parameters
circleCircle to draw.
zindexRendering order depth.

◆ fsDrawLine()

void fsDrawLine ( const FsLine * line,
int zindex )

Draws a line.

Draws a colored line.

Parameters
lineLine to draw.
zindexRendering order depth.

◆ fsDrawPoint()

void fsDrawPoint ( const FsPoint * p,
int zindex )

Draws a pixel.

Draws a colored point at the specified position.

Parameters
pPoint to draw.
zindexRendering order depth.

◆ fsDrawQuad()

void fsDrawQuad ( const FsQuad * quad,
int zindex )

Draws a quadrilateral.

Draws a colored quadrilateral.

Parameters
quadQuadrilateral to draw.
zindexRendering order depth.

◆ fsDrawSprite()

void fsDrawSprite ( const FsSprite * sprite,
int zindex )

Draws a 2D sprite.

Renders a textured sprite using its position, size, rotation angle and texture.

Parameters
spriteSprite to draw.
zindexRendering order depth.
Note
The sprite texture must be valid and loaded.
Uses OpenGL immediate mode.

◆ fsDrawTriangle()

void fsDrawTriangle ( const FsTriangle * tri,
int zindex )

Draws a triangle.

Draws a colored triangle.

Parameters
triTriangle to draw.
zindexRendering order depth.

◆ fsLookAt()

double fsLookAt ( FsVec2 origin,
FsVec2 target,
FsDirection forward )

Calculates the angle to face a target position.

Computes the rotation angle (in degrees) required for an object at a given origin position to face a target position in 2D space.

The resulting angle is adjusted based on the object's forward direction, allowing different default orientations (up, right, down, or left).

Parameters
originOrigin position.
targetTarget position to look at.
forwardForward direction of the object.
Returns
Angle in degrees required to face the target.

◆ fsOrthoSet()

void fsOrthoSet ( int width,
int height )

Sets the orthographic projection.

Defines the orthographic rendering view.

Parameters
widthWidth of the view.
heightHeight of the view.