cmdfx 0.1.0
Lightweight game engine for your terminal
Loading...
Searching...
No Matches
canvas.h File Reference

Animation Extensions for canvas.h. More...

#include "cmdfx/canvas.h"

Go to the source code of this file.

Functions

void Canvas_hLine_anim (int x, int y, int width, char c, double time)
 Draws a horizontal line at the specified position over time.
 
void Canvas_hLine_anim_reverse (int x, int y, int width, char c, double time)
 Draws a horizontal line at the specified position over time, then reverses the animation.
 
void Canvas_vLine_anim (int x, int y, int height, char c, double time)
 Draws a vertical line at the specified position over time.
 
void Canvas_vLine_anim_reverse (int x, int y, int height, char c, double time)
 Draws a vertical line at the specified position over time, then reverses the animation.
 
void Canvas_rect_anim (int x, int y, int width, int height, char c, double time)
 Draws a hollow rectangle at the specified position over time.
 
void Canvas_fillRect_anim (int x, int y, int width, int height, char c, double time)
 Fills a rectangle at the specified position over time.
 
void Canvas_line_anim (int x0, int y0, int x1, int y1, char c, double time)
 Draws a line at the specified position over time.
 
void Canvas_line_anim_reverse (int x0, int y0, int x1, int y1, char c, double time)
 Draws a line at the specified position over time, then reverses the animation.
 
void Canvas_drawText_anim (int x, int y, const char *text, double time)
 Draws text at the specified position over time.
 
void Canvas_drawText_anim_reverse (int x, int y, const char *text, double time)
 Draws text at the specified position over time, then reverses the animation.
 
void Canvas_drawAsciiText_anim (int x, int y, char character, const char *text, double time)
 Draws an ASCII character at the specified position over time.
 

Detailed Description

Animation Extensions for canvas.h.

Author
Gregory Mitchell (me@gm.nosp@m.itch.nosp@m.215.d.nosp@m.ev)
Version
0.1.0
Date
2025-01-24

Function Documentation

◆ Canvas_drawAsciiText_anim()

void Canvas_drawAsciiText_anim ( int x,
int y,
char character,
const char * text,
double time )

Draws an ASCII character at the specified position over time.

This method draws an ASCII character at the specified position over time. The character is linearly interpolated from the starting position to the ending position over the specified amount of time.

Parameters
xThe X position of the character.
yThe Y position of the character.
characterThe character to use when drawing the text.
textThe text to draw.
timeThe amount of time, in seconds, to draw the character.

◆ Canvas_drawText_anim()

void Canvas_drawText_anim ( int x,
int y,
const char * text,
double time )

Draws text at the specified position over time.

This method draws text at the specified position over time. The text is linearly interpolated from the starting position to the ending position over the specified amount of time.

Parameters
xThe X position of the text.
yThe Y position of the text.
textThe text to draw.
timeThe amount of time, in seconds, to draw the text.

◆ Canvas_drawText_anim_reverse()

void Canvas_drawText_anim_reverse ( int x,
int y,
const char * text,
double time )

Draws text at the specified position over time, then reverses the animation.

This method draws text at the specified position over time. The text is linearly interpolated from the starting position to the ending position over the specified amount of time. After the animation is complete, the text is then reversed back to the starting position.

This method will draw the text in reverse, starting from the last character and moving to the first character.

Parameters
xThe X position of the text.
yThe Y position of the text.
textThe text to draw.
timeThe amount of time, in seconds, to draw the text.

◆ Canvas_fillRect_anim()

void Canvas_fillRect_anim ( int x,
int y,
int width,
int height,
char c,
double time )

Fills a rectangle at the specified position over time.

This method fills a rectangle at the specified position over time. The rectangle is linearly interpolated from the starting position to the ending position over the specified amount of time, using the specified character.

The animation begins by filling the top row of the rectangle, then the second row, and so on until the entire rectangle is filled.

Parameters
xThe X position of the rectangle.
yThe Y position of the rectangle.
widthThe width of the rectangle.
heightThe height of the rectangle.
cThe character to use when filling the rectangle.
timeThe amount of time, in seconds, to fill the rectangle.

◆ Canvas_hLine_anim()

void Canvas_hLine_anim ( int x,
int y,
int width,
char c,
double time )

Draws a horizontal line at the specified position over time.

This method draws a horizontal line at the specified position over time. The line is linearly interpolated from the starting position to the ending position over the specified amount of time, using the specified character.

Parameters
xThe X position of the line.
yThe Y position of the line.
widthThe width of the line.
cThe character to use when drawing the line.
timeThe amount of time, in seconds, to draw the line.

◆ Canvas_hLine_anim_reverse()

void Canvas_hLine_anim_reverse ( int x,
int y,
int width,
char c,
double time )

Draws a horizontal line at the specified position over time, then reverses the animation.

This method draws a horizontal line at the specified position over time. The line is linearly interpolated from the starting position to the ending position over the specified amount of time, using the specified character. After the animation is complete, the line is then reversed back to the starting position.

This method will draw the line in reverse, starting from the right side of the line and moving to the left side.

Parameters
xThe X position of the line.
yThe Y position of the line.
widthThe width of the line.
cThe character to use when drawing the line.
timeThe amount of time, in seconds, to draw the line.

◆ Canvas_line_anim()

void Canvas_line_anim ( int x0,
int y0,
int x1,
int y1,
char c,
double time )

Draws a line at the specified position over time.

This method draws a line at the specified position over time. The line is linearly interpolated from the starting position to the ending position over the specified amount of time, using the specified character.

Parameters
x0The X position of the starting point.
y0The Y position of the starting point.
x1The X position of the ending point.
y1The Y position of the ending point.
cThe character to use when drawing the line.
timeThe amount of time, in seconds, to draw the line.

◆ Canvas_line_anim_reverse()

void Canvas_line_anim_reverse ( int x0,
int y0,
int x1,
int y1,
char c,
double time )

Draws a line at the specified position over time, then reverses the animation.

This method draws a line at the specified position over time. The line is linearly interpolated from the starting position to the ending position over the specified amount of time, using the specified character. After the animation is complete, the line is then reversed back to the starting position.

This method will draw the line in reverse, starting from the ending point and moving to the starting point.

Parameters
x0The X position of the starting point.
y0The Y position of the starting point.
x1The X position of the ending point.
y1The Y position of the ending point.
cThe character to use when drawing the line.
timeThe amount of time, in seconds, to draw the line.

◆ Canvas_rect_anim()

void Canvas_rect_anim ( int x,
int y,
int width,
int height,
char c,
double time )

Draws a hollow rectangle at the specified position over time.

This method draws a hollow rectangle at the specified position over time. The rectangle is linearly interpolated from the starting position to the ending position over the specified amount of time, using the specified character.

The animation will start on the left, then draw the top, right, and bottom sides of the rectangle.

Parameters
xThe X position of the rectangle.
yThe Y position of the rectangle.
widthThe width of the rectangle.
heightThe height of the rectangle.
cThe character to use when drawing the rectangle.
timeThe amount of time, in seconds, to draw the rectangle.

◆ Canvas_vLine_anim()

void Canvas_vLine_anim ( int x,
int y,
int height,
char c,
double time )

Draws a vertical line at the specified position over time.

This method draws a vertical line at the specified position over time. The line is linearly interpolated from the starting position to the ending position over the specified amount of time, using the specified character.

Parameters
xThe X position of the line.
yThe Y position of the line.
heightThe height of the line.
cThe character to use when drawing the line.
timeThe amount of time, in seconds, to draw the line.

◆ Canvas_vLine_anim_reverse()

void Canvas_vLine_anim_reverse ( int x,
int y,
int height,
char c,
double time )

Draws a vertical line at the specified position over time, then reverses the animation.

This method draws a vertical line at the specified position over time. The line is linearly interpolated from the starting position to the ending position over the specified amount of time, using the specified character. After the animation is complete, the line is then reversed back to the starting position.

This method will draw the line in reverse, starting from the bottom side of the line and moving to the top side.

Parameters
xThe X position of the line.
yThe Y position of the line.
heightThe height of the line.
cThe character to use when drawing the line.
timeThe amount of time, in seconds, to draw the line.