![]() |
cmdfx 0.2.0
Lightweight game engine for your terminal
|
Builder API for building 2D Character Arrays. More...
Go to the source code of this file.
Enumerations | |
enum | CmdFX_GradientDirection { GRADIENT_HORIZONTAL , GRADIENT_HORIZONTAL_REVERSE , GRADIENT_VERTICAL , GRADIENT_VERTICAL_REVERSE , GRADIENT_ANGLE_45 , GRADIENT_ANGLE_135 , GRADIENT_ANGLE_225 , GRADIENT_ANGLE_315 , GRADIENT_RADIAL , GRADIENT_CONICAL } |
Represents a color gradient that can be applied . More... | |
Functions | |
int | getCharArrayWidth (char **array) |
Gets the width of a 2D Character Array. | |
int | getCharArrayHeight (char **array) |
Gets the height of a 2D Character Array. | |
char ** | createCharArrayCopy (char **array) |
Creates a copy of a 2D Character Array. | |
char ** | Char2DBuilder_copy (char **array) |
Copies a 2D Character Array. | |
int | areCharArraysSameSize (char **array1, char **array2) |
Checks if two 2D Character Arrays are the same size. | |
int | compareCharArrays (char **array1, char **array2) |
Compares two 2D Character Arrays. | |
int | printCharArray (char **array) |
Prints a 2D Character Array. | |
char ** | Char2DBuilder_create (int width, int height) |
Creates a 2D Character Array with a specific width and height. | |
char ** | Char2DBuilder_createFilled (int width, int height, char c) |
Creates a 2D Character Array with a specific width and height, filled with a specific character. | |
int | Char2DBuilder_setChar (char **array, int x, int y, char c) |
Sets a character in a 2D Character Array. | |
int | Char2DBuilder_hLine (char **array, int x, int y, int width, char c) |
Draws a horizontal line in a 2D Character Array. | |
int | Char2DBuilder_vLine (char **array, int x, int y, int height, char c) |
Draws a vertical line in a 2D Character Array. | |
int | Char2DBuilder_rect (char **array, int x, int y, int width, int height, char c) |
Draws a rectangle in a 2D Character Array. | |
int | Char2DBuilder_fillRect (char **array, int x, int y, int width, int height, char c) |
Fills a rectangle in a 2D Character Array. | |
int | Char2DBuilder_fill (char **array, char c) |
Fills the entire 2D Character Array. | |
int | Char2DBuilder_circle (char **array, int x, int y, int radius, char c) |
Draws a circle in a 2D Character Array. | |
int | Char2DBuilder_fillCircle (char **array, int x, int y, int radius, char c) |
Fills a circle in a 2D Character Array. | |
int | Char2DBuilder_ellipse (char **array, int x, int y, int xradius, int yradius, char c) |
Draws an ellipse in a 2D Character Array. | |
int | Char2DBuilder_fillEllipse (char **array, int x, int y, int xradius, int yradius, char c) |
Fills an ellipse in a 2D Character Array. | |
int | Char2DBuilder_line (char **array, int x1, int y1, int x2, int y2, char c) |
Draws a line in a 2D Character Array. | |
int | Char2DBuilder_polygon (char **array, int x, int y, int sides, int radius, char c) |
Draws a polygon in a 2D Character Array. | |
int | Char2DBuilder_fillPolygon (char **array, int x, int y, int sides, int radius, char c) |
Fills a polygon in a 2D Character Array. | |
int | Char2DBuilder_text (char **array, int x, int y, char *text) |
Writes text in a 2D Character Array. | |
int | Char2DBuilder_resize (char **array, int width, int height) |
Resizes a 2D Character Array to a specific width and height. | |
int | Char2DBuilder_resizeWithPadding (char **array, int width, int height, char padding) |
Resizes a 2D Character Array to a specific width and height with padding. | |
int | Char2DBuilder_center (char **array) |
Centers a 2D Character Array. | |
int | Char2DBuilder_resizeAndCenter (char **array, int width, int height) |
Resizes and centers a 2D Character Array. | |
int | Char2DBuilder_rotate (char **array, double radians) |
Rotates a 2D Character Array. | |
double | Char2DBuilder_getRotationAngle (char **array) |
Gets the rotation angle of a 2D Character Array. | |
int | Char2DBuilder_hFlip (char **array) |
Flips a 2D Character Array horizontally. | |
int | Char2DBuilder_vFlip (char **array) |
Flips a 2D Character Array vertically. | |
char ** | Char2DBuilder_transpose (char **array) |
Transposes a 2D Character Array. | |
int | Char2DBuilder_replaceAll (char **array, char find, char replace) |
Replaces all instances of a character in a 2D Character Array. | |
char ** | Char2DBuilder_scale (char **array, double scale) |
Scales a 2D Character Array. | |
int | Char2DBuilder_gradient (char **array, int x, int y, int width, int height, char start, char end, enum CmdFX_GradientDirection direction) |
Creates a gradient in a 2D Character Array. | |
int | Char2DBuilder_multiGradient (char **array, int x, int y, int width, int height, int numChars, char *gradient, enum CmdFX_GradientDirection direction) |
Creates a multi-gradient in a 2D Character Array. | |
int | Char2DBuilder_multiGradients (char **array, int x, int y, int width, int height, int numChars, char *gradient, double *percentages, enum CmdFX_GradientDirection direction) |
Creates a multi-gradient in a 2D Character Array with percentages. | |
int | Char2DBuilder_gradientFull (char **array, char start, char end, enum CmdFX_GradientDirection direction) |
Creates a full gradient in a 2D Character Array. | |
int | Char2DBuilder_multiGradientFull (char **array, int numChars, char *gradient, enum CmdFX_GradientDirection direction) |
Creates a multi-gradient in a 2D Character Array. | |
int | Char2DBuilder_multiGradientsFull (char **array, int numChars, char *gradient, double *percentages, enum CmdFX_GradientDirection direction) |
Creates a multi-gradient in a 2D Character Array with percentages. | |
int | getStringArrayWidth (char ***array) |
Gets the width of a 2D String Array. | |
int | getStringArrayHeight (char ***array) |
Gets the height of a 2D String Array. | |
char *** | createStringArrayCopy (char ***array) |
Creates a copy of a 2D String Array. | |
int | clearStringArray (char ***array) |
Clears a 2D String Array. | |
int | areStringArraysSameSize (char ***array1, char ***array2) |
Checks if two 2D String Arrays are the same size. | |
int | compareStringArrays (char ***array1, char ***array2) |
Compares two 2D String Arrays. | |
int | printStringArray (char ***array) |
Prints a 2D String Array. | |
char *** | String2DBuilder_create (int width, int height) |
Creates a 2D String Array with a specific width and height. | |
char *** | String2DBuilder_createFilled (int width, int height, char *c) |
Creates a 2D String Array with a specific width and height, filled with a specific string. | |
int | String2DBuilder_setAnsi (char ***array, int x, int y, char *c) |
Sets an ANSI code in a 2D String Array. | |
int | String2DBuilder_hLine (char ***array, int x, int y, int width, char *c) |
Draws a horizontal line in a 2D String Array. | |
int | String2DBuilder_vLine (char ***array, int x, int y, int height, char *c) |
Draws a vertical line in a 2D String Array. | |
int | String2DBuilder_rect (char ***array, int x, int y, int width, int height, char *c) |
Draws a rectangle in a 2D String Array. | |
int | String2DBuilder_fillRect (char ***array, int x, int y, int width, int height, char *c) |
Fills a rectangle in a 2D String Array. | |
int | String2DBuilder_fill (char ***array, char *c) |
Fills the entire 2D String Array. | |
int | String2DBuilder_circle (char ***array, int x, int y, int radius, char *c) |
Draws a circle in a 2D String Array. | |
int | String2DBuilder_fillCircle (char ***array, int x, int y, int radius, char *c) |
Fills a circle in a 2D String Array. | |
int | String2DBuilder_ellipse (char ***array, int x, int y, int xradius, int yradius, char *c) |
Draws an ellipse in a 2D String Array. | |
int | String2DBuilder_fillEllipse (char ***array, int x, int y, int xradius, int yradius, char *c) |
Fills an ellipse in a 2D String Array. | |
int | String2DBuilder_line (char ***array, int x1, int y1, int x2, int y2, char *c) |
Draws a line in a 2D String Array. | |
int | String2DBuilder_polygon (char ***array, int x, int y, int sides, int radius, char *c) |
Draws a polygon in a 2D String Array. | |
int | String2DBuilder_fillPolygon (char ***array, int x, int y, int sides, int radius, char *c) |
Fills a polygon in a 2D String Array. | |
int | String2DBuilder_rotate (char ***array, double radians) |
Rotates a 2D String Array. | |
int | String2DBuilder_hFlip (char ***array) |
Flips a 2D String Array horizontally. | |
int | String2DBuilder_vFlip (char ***array) |
Flips a 2D String Array vertically. | |
char *** | String2DBuilder_transpose (char ***array) |
Transposes a 2D String Array. | |
int | String2DBuilder_replaceAll (char ***array, char *find, char *replace) |
Replaces all instances of an ANSI code in a 2D String Array. | |
char *** | String2DBuilder_scale (char ***array, double scale) |
Scales a 2D String Array. | |
int | String2DBuilder_gradientForeground (char ***array, int x, int y, int width, int height, int start, int end, enum CmdFX_GradientDirection direction) |
Sets a foreground gradient in a 2D String Array. | |
int | String2DBuilder_gradientBackground (char ***array, int x, int y, int width, int height, int start, int end, enum CmdFX_GradientDirection direction) |
Sets a background gradient in a 2D String Array. | |
int | String2DBuilder_multiGradientForeground (char ***array, int x, int y, int width, int height, int numColors, int *colors, enum CmdFX_GradientDirection direction) |
Sets a foreground gradient in a 2D String Array. | |
int | String2DBuilder_multiGradientBackground (char ***array, int x, int y, int width, int height, int numColors, int *colors, enum CmdFX_GradientDirection direction) |
Sets a background gradient in a 2D String Array. | |
int | String2DBuilder_multiGradientsForeground (char ***array, int x, int y, int width, int height, int numColors, int *colors, double *percentages, enum CmdFX_GradientDirection direction) |
Sets a foreground gradient in a 2D String Array. | |
int | String2DBuilder_multiGradientsBackground (char ***array, int x, int y, int width, int height, int numColors, int *colors, double *percentages, enum CmdFX_GradientDirection direction) |
Sets a background gradient in a 2D String Array. | |
int | String2DBuilder_gradientForegroundFull (char ***array, int start, int end, enum CmdFX_GradientDirection direction) |
Sets a background gradient in a 2D String Array. | |
int | String2DBuilder_gradientBackgroundFull (char ***array, int start, int end, enum CmdFX_GradientDirection direction) |
Sets a background gradient in a 2D String Array. | |
int | String2DBuilder_multiGradientForegroundFull (char ***array, int numColors, int *colors, enum CmdFX_GradientDirection direction) |
Sets a foreground gradient in a 2D String Array. | |
int | String2DBuilder_multiGradientBackgroundFull (char ***array, int numColors, int *colors, enum CmdFX_GradientDirection direction) |
Sets a background gradient in a 2D String Array. | |
int | String2DBuilder_multiGradientsForegroundFull (char ***array, int numColors, int *colors, double *percentages, enum CmdFX_GradientDirection direction) |
Sets a foreground gradient in a 2D String Array. | |
int | String2DBuilder_multiGradientsBackgroundFull (char ***array, int numColors, int *colors, double *percentages, enum CmdFX_GradientDirection direction) |
Sets a background gradient in a 2D String Array. | |
Builder API for building 2D Character Arrays.
Represents a color gradient that can be applied .
A color gradient is a smooth transition between two or more colors. The gradient can be applied to the foreground or background, and can be applied in different directions.
int areCharArraysSameSize | ( | char ** | array1, |
char ** | array2 ) |
Checks if two 2D Character Arrays are the same size.
This method checks if two 2D Character Arrays are the same size. If the two arrays are the same size, the method will return 1. If the two arrays are not the same size, the method will return 0.
array1 | The first 2D Character Array. |
array2 | The second 2D Character Array. |
int areStringArraysSameSize | ( | char *** | array1, |
char *** | array2 ) |
Checks if two 2D String Arrays are the same size.
This method checks if two 2D String Arrays are the same size. If the two arrays are the same size, the method will return 1. If the two arrays are not the same size, the method will return 0.
array1 | The first 2D String Array. |
array2 | The second 2D String Array. |
int Char2DBuilder_center | ( | char ** | array | ) |
Centers a 2D Character Array.
This method centers a 2D Character Array both horizontally and vertically. It will reposition the characters depending on whether there is whitespace surrounding other characters.
array | The 2D Character Array. |
int Char2DBuilder_circle | ( | char ** | array, |
int | x, | ||
int | y, | ||
int | radius, | ||
char | c ) |
Draws a circle in a 2D Character Array.
array | The character array. |
x | The x coordinate. |
y | The y coordinate. |
radius | The radius of the circle. |
c | The character to draw the circle with. |
char ** Char2DBuilder_copy | ( | char ** | array | ) |
Copies a 2D Character Array.
This method creates a copy of a 2D Character Array. The new array must be freed after use.
array | The 2D Character Array. |
char ** Char2DBuilder_create | ( | int | width, |
int | height ) |
Creates a 2D Character Array with a specific width and height.
This method creates an array with a specific width and height. The array will be initialized with the space character.
The values at array[height]
will be set to 0 for null termination. It is advised that you create a char**
with this method and pass it to other functions presented in this header file, rather than create a char**
and pass it to other functions, in order to avoid undefined behavior.
width | The width of the array. |
height | The height of the array. |
char ** Char2DBuilder_createFilled | ( | int | width, |
int | height, | ||
char | c ) |
Creates a 2D Character Array with a specific width and height, filled with a specific character.
This method creates an array with a specific width and height. The array will be initialized with the specified character.
The values at array[height]
will be set to 0 for null termination. It is advised that you create a char**
with this method and pass it to other functions presented in this header file, rather than create a char**
and pass it to other functions, in order to avoid undefined behavior.
width | The width of the array. |
height | The height of the array. |
c | The character to fill the array with. |
int Char2DBuilder_ellipse | ( | char ** | array, |
int | x, | ||
int | y, | ||
int | xradius, | ||
int | yradius, | ||
char | c ) |
Draws an ellipse in a 2D Character Array.
array | The character array. |
x | The x coordinate. |
y | The y coordinate. |
xradius | The x radius of the ellipse. |
yradius | The y radius of the ellipse. |
c | The character to draw the ellipse with. |
int Char2DBuilder_fill | ( | char ** | array, |
char | c ) |
Fills the entire 2D Character Array.
array | The character array. |
c | The character to fill the array with. |
int Char2DBuilder_fillCircle | ( | char ** | array, |
int | x, | ||
int | y, | ||
int | radius, | ||
char | c ) |
Fills a circle in a 2D Character Array.
array | The character array. |
x | The x coordinate. |
y | The y coordinate. |
radius | The radius of the circle. |
c | The character to fill the circle with. |
int Char2DBuilder_fillEllipse | ( | char ** | array, |
int | x, | ||
int | y, | ||
int | xradius, | ||
int | yradius, | ||
char | c ) |
Fills an ellipse in a 2D Character Array.
array | The character array. |
x | The x coordinate. |
y | The y coordinate. |
xradius | The x radius of the ellipse. |
yradius | The y radius of the ellipse. |
c | The character to fill the ellipse with. |
int Char2DBuilder_fillPolygon | ( | char ** | array, |
int | x, | ||
int | y, | ||
int | sides, | ||
int | radius, | ||
char | c ) |
Fills a polygon in a 2D Character Array.
This method fills a polygon in a 2D Character Array. If the x or y coordinate is out of bounds, the method will return -1. If the polygon goes out of bounds, the polygon will be cropped.
array | The character array. |
x | The x coordinate. |
y | The y coordinate. |
sides | The number of sides of the polygon. |
radius | The radius of the polygon. |
c | The character to fill the polygon with. |
int Char2DBuilder_fillRect | ( | char ** | array, |
int | x, | ||
int | y, | ||
int | width, | ||
int | height, | ||
char | c ) |
Fills a rectangle in a 2D Character Array.
array | The character array. |
x | The x coordinate. |
y | The y coordinate. |
width | The width of the rectangle. |
height | The height of the rectangle. |
c | The character to fill the rectangle with. |
double Char2DBuilder_getRotationAngle | ( | char ** | array | ) |
Gets the rotation angle of a 2D Character Array.
This method returns the rotation angle of a 2D Character Array in radians. The angle will be between -PI and PI. If the 2D Character Array is not rotated, the method will return 0. Rotation is calculated by the number of whitespace characters in the 2D Character Array, meaning this method relies on whether it is visually rotated or not.
array | The 2D Character Array. |
int Char2DBuilder_gradient | ( | char ** | array, |
int | x, | ||
int | y, | ||
int | width, | ||
int | height, | ||
char | start, | ||
char | end, | ||
enum CmdFX_GradientDirection | direction ) |
Creates a gradient in a 2D Character Array.
This method creates a gradient in a 2D Character Array. The gradient will be created from the start character to the end character. The gradient will be created in the specified direction.
This function supports a simple gradient from one character to another at 50% each.
array | The 2D Character Array. |
x | The x coordinate. |
y | The y coordinate. |
width | The width of the gradient. |
height | The height of the gradient. |
start | The start character. |
end | The end character. |
direction | The direction of the gradient. |
int Char2DBuilder_gradientFull | ( | char ** | array, |
char | start, | ||
char | end, | ||
enum CmdFX_GradientDirection | direction ) |
Creates a full gradient in a 2D Character Array.
This method creates a full gradient in a 2D Character Array. The gradient will be created from the start character to the end character. The gradient will be created in the specified direction.
This function supports a full gradient from one character to another.
array | The 2D Character Array. |
start | The start character. |
end | The end character. |
direction | The direction of the gradient. |
int Char2DBuilder_hFlip | ( | char ** | array | ) |
Flips a 2D Character Array horizontally.
array | The 2D Character Array. |
int Char2DBuilder_hLine | ( | char ** | array, |
int | x, | ||
int | y, | ||
int | width, | ||
char | c ) |
Draws a horizontal line in a 2D Character Array.
This method draws a horizontal line in a 2D Character Array. If the x or y coordinate is out of bounds, the method will return -1. If the line goes out of bounds, the line will be cropped.
array | The character array. |
x | The x coordinate. |
y | The y coordinate. |
width | The width of the line. |
c | The character to draw the line with. |
int Char2DBuilder_line | ( | char ** | array, |
int | x1, | ||
int | y1, | ||
int | x2, | ||
int | y2, | ||
char | c ) |
Draws a line in a 2D Character Array.
array | The character array. |
x1 | The x coordinate of the first point. |
y1 | The y coordinate of the first point. |
x2 | The x coordinate of the second point. |
y2 | The y coordinate of the second point. |
c | The character to draw the line with. |
int Char2DBuilder_multiGradient | ( | char ** | array, |
int | x, | ||
int | y, | ||
int | width, | ||
int | height, | ||
int | numChars, | ||
char * | gradient, | ||
enum CmdFX_GradientDirection | direction ) |
Creates a multi-gradient in a 2D Character Array.
This method creates a multi-gradient in a 2D Character Array. The gradient will be created from the start character to the end character. The gradient will be created in the specified direction.
This function supports a multi-gradient from multiple characters at equal intervals.
array | The 2D Character Array. |
x | The x coordinate. |
y | The y coordinate. |
width | The width of the gradient. |
height | The height of the gradient. |
numChars | The number of characters in the gradient. |
gradient | The gradient characters. |
direction | The direction of the gradient. |
int Char2DBuilder_multiGradientFull | ( | char ** | array, |
int | numChars, | ||
char * | gradient, | ||
enum CmdFX_GradientDirection | direction ) |
Creates a multi-gradient in a 2D Character Array.
This method creates a multi-gradient in a 2D Character Array. The gradient will be created from the start character to the end character. The gradient will be created in the specified direction.
This function supports a multi-gradient from multiple characters at equal intervals.
array | The 2D Character Array. |
numChars | The number of characters in the gradient. |
gradient | The gradient characters. |
direction | The direction of the gradient. |
int Char2DBuilder_multiGradients | ( | char ** | array, |
int | x, | ||
int | y, | ||
int | width, | ||
int | height, | ||
int | numChars, | ||
char * | gradient, | ||
double * | percentages, | ||
enum CmdFX_GradientDirection | direction ) |
Creates a multi-gradient in a 2D Character Array with percentages.
This method creates a multi-gradient in a 2D Character Array. The gradient will be created from the start character to the end character. The gradient will be created in the specified direction.
This function supports a multi-gradient from multiple characters at specific percentages.
array | The 2D Character Array. |
x | The x coordinate. |
y | The y coordinate. |
width | The width of the gradient. |
height | The height of the gradient. |
numChars | The number of characters in the gradient. |
gradient | The gradient characters. |
percentages | The percentages of the gradient. |
direction | The direction of the gradient. |
int Char2DBuilder_multiGradientsFull | ( | char ** | array, |
int | numChars, | ||
char * | gradient, | ||
double * | percentages, | ||
enum CmdFX_GradientDirection | direction ) |
Creates a multi-gradient in a 2D Character Array with percentages.
This method creates a multi-gradient in a 2D Character Array. The gradient will be created from the start character to the end character. The gradient will be created in the specified direction.
This function supports a multi-gradient from multiple characters at specific percentages.
array | The 2D Character Array. |
numChars | The number of characters in the gradient. |
gradient | The gradient characters. |
percentages | The percentages of the gradient. |
direction | The direction of the gradient. |
int Char2DBuilder_polygon | ( | char ** | array, |
int | x, | ||
int | y, | ||
int | sides, | ||
int | radius, | ||
char | c ) |
Draws a polygon in a 2D Character Array.
This method draws a polygon in a 2D Character Array. If the x or y coordinate is out of bounds, the method will return -1. If the polygon goes out of bounds, the polygon will be cropped.
array | The character array. |
x | The x coordinate. |
y | The y coordinate. |
sides | The number of sides of the polygon. |
radius | The radius of the polygon. |
c | The character to draw the polygon with. |
int Char2DBuilder_rect | ( | char ** | array, |
int | x, | ||
int | y, | ||
int | width, | ||
int | height, | ||
char | c ) |
Draws a rectangle in a 2D Character Array.
This method draws a rectangle in a 2D Character Array. If the x or y coordinate is out of bounds, the method will return -1. If the rectangle goes out of bounds, the rectangle will be cropped.
array | The character array. |
x | The x coordinate. |
y | The y coordinate. |
width | The width of the rectangle. |
height | The height of the rectangle. |
c | The character to draw the rectangle with. |
int Char2DBuilder_replaceAll | ( | char ** | array, |
char | find, | ||
char | replace ) |
Replaces all instances of a character in a 2D Character Array.
array | The 2D Character Array. |
find | The character to find. |
replace | The character to replace the found character with. |
int Char2DBuilder_resize | ( | char ** | array, |
int | width, | ||
int | height ) |
Resizes a 2D Character Array to a specific width and height.
This method resizes a 2D Character Array to a specific width and height. If the new width or height is smaller than the original width or height, the 2D Character Array will be cropped. If the new width or height is larger than the original width or height, the 2D Character Array will be padded with empty space.
array | The 2D Character Array. |
width | The new width. |
height | The new height. |
int Char2DBuilder_resizeAndCenter | ( | char ** | array, |
int | width, | ||
int | height ) |
Resizes and centers a 2D Character Array.
This method resizes and centers a 2D Character Array to a specific width and height. If the new width or height is smaller than the original width or height, the ASCII art character will be cropped. If the new width or height is larger than the original width or height, the 2D Character Array will be padded with the specified character.
array | The 2D Character Array. |
width | The new width. |
height | The new height. |
int Char2DBuilder_resizeWithPadding | ( | char ** | array, |
int | width, | ||
int | height, | ||
char | padding ) |
Resizes a 2D Character Array to a specific width and height with padding.
This method resizes a 2D Character Array to a specific width and height with padding. If the new width or height is smaller than the original width or height, the ASCII art character will be cropped. If the new width or height is larger than the original width or height, the 2D Character Array will be padded with the specified character.
array | The 2D Character Array. |
width | The new width. |
height | The new height. |
padding | The padding character. |
int Char2DBuilder_rotate | ( | char ** | array, |
double | radians ) |
Rotates a 2D Character Array.
This method rotates a 2D Character Array by a specific number of radians. The rotation will be done around the center of the 2D Character Array.
array | The 2D Character Array. |
radians | The number of radians to rotate. |
char ** Char2DBuilder_scale | ( | char ** | array, |
double | scale ) |
Scales a 2D Character Array.
This method scales a 2D Character Array by a specific factor. The scaling will be done around the center of the 2D Character Array.
The original 2D Character Array will be freed.
array | The 2D Character Array. |
scale | The factor to scale the 2D Character Array by. |
int Char2DBuilder_setChar | ( | char ** | array, |
int | x, | ||
int | y, | ||
char | c ) |
Sets a character in a 2D Character Array.
This method sets a character at the specified x and y coordinates. If the x or y coordinate is out of bounds, the method will return -1.
array | The 2D Character Array. |
x | The x coordinate. |
y | The y coordinate |
c | The character to set. |
int Char2DBuilder_text | ( | char ** | array, |
int | x, | ||
int | y, | ||
char * | text ) |
Writes text in a 2D Character Array.
If the text is too long to fit in the array, it will be wrapped to the next line. If the text is too long to fit in the array at all, the string will be truncated.
array | The character array. |
x | The x coordinate. |
y | The y coordinate. |
text | The text to draw. |
char ** Char2DBuilder_transpose | ( | char ** | array | ) |
Transposes a 2D Character Array.
This method transposes a 2D Character Array, then returns the transposed 2D Character Array. The original 2D Character Array will be freed.
array | The 2D Character Array. |
int Char2DBuilder_vFlip | ( | char ** | array | ) |
Flips a 2D Character Array vertically.
array | The 2D Character Array. |
int Char2DBuilder_vLine | ( | char ** | array, |
int | x, | ||
int | y, | ||
int | height, | ||
char | c ) |
Draws a vertical line in a 2D Character Array.
This method draws a vertical line in a 2D Character Array. If the x or y coordinate is out of bounds, the method will return -1. If the line goes out of bounds, the line will be cropped.
array | The character array. |
x | The x coordinate. |
y | The y coordinate. |
height | The height of the line. |
c | The character to draw the line with. |
int clearStringArray | ( | char *** | array | ) |
Clears a 2D String Array.
This method clears a 2D String Array. The array will be filled with the space character.
array | The 2D String Array. |
int compareCharArrays | ( | char ** | array1, |
char ** | array2 ) |
Compares two 2D Character Arrays.
This method compares two 2D Character Arrays. If the two arrays are equal, the method will return 0. If the two arrays are not equal, the method will return -1.
array1 | The first 2D Character Array. |
array2 | The second 2D Character Array. |
int compareStringArrays | ( | char *** | array1, |
char *** | array2 ) |
Compares two 2D String Arrays.
This method compares two 2D String Arrays. If the two arrays are equal, the method will return 0. If the two arrays are not equal, the method will return -1.
array1 | The first 2D String Array. |
array2 | The second 2D String Array. |
char ** createCharArrayCopy | ( | char ** | array | ) |
Creates a copy of a 2D Character Array.
array | The 2D Character Array. |
char *** createStringArrayCopy | ( | char *** | array | ) |
Creates a copy of a 2D String Array.
array | The 2D String Array. |
int getCharArrayHeight | ( | char ** | array | ) |
Gets the height of a 2D Character Array.
array | The 2D Character Array. |
int getCharArrayWidth | ( | char ** | array | ) |
Gets the width of a 2D Character Array.
array | The 2D Character Array. |
int getStringArrayHeight | ( | char *** | array | ) |
Gets the height of a 2D String Array.
array | The 2D String Array. |
int getStringArrayWidth | ( | char *** | array | ) |
Gets the width of a 2D String Array.
array | The 2D String Array. |
int printCharArray | ( | char ** | array | ) |
Prints a 2D Character Array.
This method prints a 2D Character Array to the console.
array | The 2D Character Array. |
int printStringArray | ( | char *** | array | ) |
Prints a 2D String Array.
This method prints a 2D String Array. The array will be printed to the console.
array | The 2D String Array. |
int String2DBuilder_circle | ( | char *** | array, |
int | x, | ||
int | y, | ||
int | radius, | ||
char * | c ) |
Draws a circle in a 2D String Array.
Like all methods in AnsiBuilder, this does not append anything to the string. You will need to input the full ANSI code, like "\033[31m" for red text.
array | The string array. |
x | The x coordinate. |
y | The y coordinate. |
radius | The radius of the circle. |
c | The ANSI code to draw the circle with. |
char *** String2DBuilder_create | ( | int | width, |
int | height ) |
Creates a 2D String Array with a specific width and height.
Like all methods in AnsiBuilder, this does not append anything to the string. You will need to input the full ANSI code, like "\033[31m" for red text.
This method creates an array with a specific width and height. The array will be initialized with the space character.
width | The width of the array. |
height | The height of the array. |
char *** String2DBuilder_createFilled | ( | int | width, |
int | height, | ||
char * | c ) |
Creates a 2D String Array with a specific width and height, filled with a specific string.
Like all methods in AnsiBuilder, this does not append anything to the string. You will need to input the full ANSI code, like "\033[31m" for red text.
This method creates an array with a specific width and height. The array will be initialized with the specified string.
width | The width of the array. |
height | The height of the array. |
c | The string to fill the array with. |
int String2DBuilder_ellipse | ( | char *** | array, |
int | x, | ||
int | y, | ||
int | xradius, | ||
int | yradius, | ||
char * | c ) |
Draws an ellipse in a 2D String Array.
Like all methods in AnsiBuilder, this does not append anything to the string. You will need to input the full ANSI code, like "\033[31m" for red text.
array | The string array. |
x | The x coordinate. |
y | The y coordinate. |
xradius | The x radius of the ellipse. |
yradius | The y radius of the ellipse. |
c | The ANSI code to draw the ellipse with. |
int String2DBuilder_fill | ( | char *** | array, |
char * | c ) |
Fills the entire 2D String Array.
Like all methods in AnsiBuilder, this does not append anything to the string. You will need to input the full ANSI code, like "\033[31m" for red text.
array | The string array. |
c | The ANSI code to fill the array with. |
int String2DBuilder_fillCircle | ( | char *** | array, |
int | x, | ||
int | y, | ||
int | radius, | ||
char * | c ) |
Fills a circle in a 2D String Array.
Like all methods in AnsiBuilder, this does not append anything to the string. You will need to input the full ANSI code, like "\033[31m" for red text.
array | The string array. |
x | The x coordinate. |
y | The y coordinate. |
radius | The radius of the circle. |
c | The ANSI code to fill the circle with. |
int String2DBuilder_fillEllipse | ( | char *** | array, |
int | x, | ||
int | y, | ||
int | xradius, | ||
int | yradius, | ||
char * | c ) |
Fills an ellipse in a 2D String Array.
Like all methods in AnsiBuilder, this does not append anything to the string. You will need to input the full ANSI code, like "\033[31m" for red text.
array | The string array. |
x | The x coordinate. |
y | The y coordinate. |
xradius | The x radius of the ellipse. |
yradius | The y radius of the ellipse. |
c | The ANSI code to fill the ellipse with. |
int String2DBuilder_fillPolygon | ( | char *** | array, |
int | x, | ||
int | y, | ||
int | sides, | ||
int | radius, | ||
char * | c ) |
Fills a polygon in a 2D String Array.
Like all methods in AnsiBuilder, this does not append anything to the string. You will need to input the full ANSI code, like "\033[31m" for red text.
This method fills a polygon in a 2D String Array. If the x or y coordinate is out of bounds, the method will return -1. If the polygon goes out of bounds, the polygon will be cropped.
array | The string array. |
x | The x coordinate. |
y | The y coordinate. |
sides | The number of sides of the polygon. |
radius | The radius of the polygon. |
c | The ANSI code to fill the polygon with. |
int String2DBuilder_fillRect | ( | char *** | array, |
int | x, | ||
int | y, | ||
int | width, | ||
int | height, | ||
char * | c ) |
Fills a rectangle in a 2D String Array.
Like all methods in AnsiBuilder, this does not append anything to the string. You will need to input the full ANSI code, like "\033[31m" for red text.
array | The string array. |
x | The x coordinate. |
y | The y coordinate. |
width | The width of the rectangle. |
height | The height of the rectangle. |
c | The ANSI code to fill the rectangle with. |
int String2DBuilder_gradientBackground | ( | char *** | array, |
int | x, | ||
int | y, | ||
int | width, | ||
int | height, | ||
int | start, | ||
int | end, | ||
enum CmdFX_GradientDirection | direction ) |
Sets a background gradient in a 2D String Array.
This method sets a gradient in a 2D String Array. The gradient will be set from the start RGB code to the end RGB code in the specified bounds. The direction of the gradient can be specified.
This function supports a simple gradient with 2 colors at 50% each.
array | The 2D String Array. |
x | The x coordinate. |
y | The y coordinate. |
width | The width of the gradient. |
height | The height of the gradient. |
start | The start RGB code. |
end | The end RGB code. |
direction |
int String2DBuilder_gradientBackgroundFull | ( | char *** | array, |
int | start, | ||
int | end, | ||
enum CmdFX_GradientDirection | direction ) |
Sets a background gradient in a 2D String Array.
This method sets a gradient in a 2D String Array. The gradient will be set from the start RGB code to the end RGB code in the specified bounds. The direction of the gradient can be specified.
This function supports a full gradient with multiple colors at different intervals.
array | The 2D String Array. |
start | The start RGB code. |
end | The end RGB code. |
direction | The direction of the gradient. |
int String2DBuilder_gradientForeground | ( | char *** | array, |
int | x, | ||
int | y, | ||
int | width, | ||
int | height, | ||
int | start, | ||
int | end, | ||
enum CmdFX_GradientDirection | direction ) |
Sets a foreground gradient in a 2D String Array.
This method sets a gradient in a 2D String Array. The gradient will be set from the start RGB code to the end RGB code in the specified bounds. The direction of the gradient can be specified.
This function supports a simple gradient with 2 colors at 50% each.
array | The 2D String Array. |
x | The x coordinate. |
y | The y coordinate. |
width | The width of the gradient. |
height | The height of the gradient. |
start | The start RGB code. |
end | The end RGB code. |
direction |
int String2DBuilder_gradientForegroundFull | ( | char *** | array, |
int | start, | ||
int | end, | ||
enum CmdFX_GradientDirection | direction ) |
Sets a background gradient in a 2D String Array.
This method sets a gradient in a 2D String Array. The gradient will be set from the start RGB code to the end RGB code in the specified bounds. The direction of the gradient can be specified.
This function supports a full gradient with multiple colors at different intervals.
array | The 2D String Array. |
start | The start RGB code. |
end | The end RGB code. |
direction | The direction of the gradient. |
int String2DBuilder_hFlip | ( | char *** | array | ) |
Flips a 2D String Array horizontally.
array | The 2D String Array. |
int String2DBuilder_hLine | ( | char *** | array, |
int | x, | ||
int | y, | ||
int | width, | ||
char * | c ) |
Draws a horizontal line in a 2D String Array.
Like all methods in AnsiBuilder, this does not append anything to the string. You will need to input the full ANSI code, like "\033[31m" for red text.
array | The string array. |
x | The x coordinate. |
y | The y coordinate. |
width | The width of the line. |
c | The ANSI code to draw the line with. |
int String2DBuilder_line | ( | char *** | array, |
int | x1, | ||
int | y1, | ||
int | x2, | ||
int | y2, | ||
char * | c ) |
Draws a line in a 2D String Array.
Like all methods in AnsiBuilder, this does not append anything to the string. You will need to input the full ANSI code, like "\033[31m" for red text.
array | The string array. |
x1 | The x coordinate of the first point. |
y1 | The y coordinate of the first point. |
x2 | The x coordinate of the second point. |
y2 | The y coordinate of the second point. |
c | The ANSI code to draw the line with. |
int String2DBuilder_multiGradientBackground | ( | char *** | array, |
int | x, | ||
int | y, | ||
int | width, | ||
int | height, | ||
int | numColors, | ||
int * | colors, | ||
enum CmdFX_GradientDirection | direction ) |
Sets a background gradient in a 2D String Array.
This method sets a gradient in a 2D String Array. The gradient will be set from the start RGB code to the end RGB code in the specified bounds. The direction of the gradient can be specified.
This function supports a multi-gradient with multiple colors at equal intervals.
array | The 2D String Array. |
x | The x coordinate. |
y | The y coordinate. |
width | The width of the gradient. |
height | The height of the gradient. |
numColors | The number of colors in the gradient |
colors | The RGB colors in the gradient. |
direction | The direction of the gradient. |
int String2DBuilder_multiGradientBackgroundFull | ( | char *** | array, |
int | numColors, | ||
int * | colors, | ||
enum CmdFX_GradientDirection | direction ) |
Sets a background gradient in a 2D String Array.
This method sets a gradient in a 2D String Array. The gradient will be set from the start RGB code to the end RGB code in the specified bounds. The direction of the gradient can be specified.
This function supports a multi-gradient with multiple colors at equal intervals.
array | The 2D String Array. |
numColors | The number of colors in the gradient |
colors | The RGB colors in the gradient. |
direction | The direction of the gradient. |
int String2DBuilder_multiGradientForeground | ( | char *** | array, |
int | x, | ||
int | y, | ||
int | width, | ||
int | height, | ||
int | numColors, | ||
int * | colors, | ||
enum CmdFX_GradientDirection | direction ) |
Sets a foreground gradient in a 2D String Array.
This method sets a gradient in a 2D String Array. The gradient will be set from the start RGB code to the end RGB code in the specified bounds. The direction of the gradient can be specified.
This function supports a multi-gradient with multiple colors at equal intervals.
array | The 2D String Array. |
x | The x coordinate. |
y | The y coordinate. |
width | The width of the gradient. |
height | The height of the gradient. |
numColors | The number of colors in the gradient |
colors | The RGB colors in the gradient. |
direction | The direction of the gradient. |
int String2DBuilder_multiGradientForegroundFull | ( | char *** | array, |
int | numColors, | ||
int * | colors, | ||
enum CmdFX_GradientDirection | direction ) |
Sets a foreground gradient in a 2D String Array.
This method sets a gradient in a 2D String Array. The gradient will be set from the start RGB code to the end RGB code in the specified bounds. The direction of the gradient can be specified.
This function supports a multi-gradient with multiple colors at equal intervals.
array | The 2D String Array. |
numColors | The number of colors in the gradient |
colors | The RGB colors in the gradient. |
direction | The direction of the gradient. |
int String2DBuilder_multiGradientsBackground | ( | char *** | array, |
int | x, | ||
int | y, | ||
int | width, | ||
int | height, | ||
int | numColors, | ||
int * | colors, | ||
double * | percentages, | ||
enum CmdFX_GradientDirection | direction ) |
Sets a background gradient in a 2D String Array.
This method sets a gradient in a 2D String Array. The gradient will be set from the start RGB code to the end RGB code in the specified bounds. The direction of the gradient can be specified.
This function supports a multi-gradient with multiple colors at different intervals.
array | The 2D String Array. |
x | The x coordinate. |
y | The y coordinate. |
width | The width of the gradient. |
height | The height of the gradient. |
numColors | The number of colors in the gradient |
colors | The RGB colors in the gradient. |
percentages | The percentages of each color in the gradient. |
direction | The direction of the gradient. |
int String2DBuilder_multiGradientsBackgroundFull | ( | char *** | array, |
int | numColors, | ||
int * | colors, | ||
double * | percentages, | ||
enum CmdFX_GradientDirection | direction ) |
Sets a background gradient in a 2D String Array.
This method sets a gradient in a 2D String Array. The gradient will be set from the start RGB code to the end RGB code in the specified bounds. The direction of the gradient can be specified.
This function supports a multi-gradient with multiple colors at different intervals.
array | The 2D String Array. |
numColors | The number of colors in the gradient |
colors | The RGB colors in the gradient. |
percentages | The percentages of each color in the gradient. |
direction | The direction of the gradient. |
int String2DBuilder_multiGradientsForeground | ( | char *** | array, |
int | x, | ||
int | y, | ||
int | width, | ||
int | height, | ||
int | numColors, | ||
int * | colors, | ||
double * | percentages, | ||
enum CmdFX_GradientDirection | direction ) |
Sets a foreground gradient in a 2D String Array.
This method sets a gradient in a 2D String Array. The gradient will be set from the start RGB code to the end RGB code in the specified bounds. The direction of the gradient can be specified.
This function supports a multi-gradient with multiple colors at different intervals.
array | The 2D String Array. |
x | The x coordinate. |
y | The y coordinate. |
width | The width of the gradient. |
height | The height of the gradient. |
numColors | The number of colors in the gradient |
colors | The RGB colors in the gradient. |
percentages | The percentages of each color in the gradient. |
direction | The direction of the gradient. |
int String2DBuilder_multiGradientsForegroundFull | ( | char *** | array, |
int | numColors, | ||
int * | colors, | ||
double * | percentages, | ||
enum CmdFX_GradientDirection | direction ) |
Sets a foreground gradient in a 2D String Array.
This method sets a gradient in a 2D String Array. The gradient will be set from the start RGB code to the end RGB code in the specified bounds. The direction of the gradient can be specified.
This function supports a multi-gradient with multiple colors at different intervals.
array | The 2D String Array. |
numColors | The number of colors in the gradient |
colors | The RGB colors in the gradient. |
percentages | The percentages of each color in the gradient. |
direction | The direction of the gradient. |
int String2DBuilder_polygon | ( | char *** | array, |
int | x, | ||
int | y, | ||
int | sides, | ||
int | radius, | ||
char * | c ) |
Draws a polygon in a 2D String Array.
Like all methods in AnsiBuilder, this does not append anything to the string. You will need to input the full ANSI code, like "\033[31m" for red text.
This method draws a polygon in a 2D String Array. If the x or y coordinate is out of bounds, the method will return -1. If the polygon goes out of bounds, the polygon will be cropped.
array | The string array. |
x | The x coordinate. |
y | The y coordinate. |
sides | The number of sides of the polygon. |
radius | The radius of the polygon. |
c | The ANSI code to draw the polygon with. |
int String2DBuilder_rect | ( | char *** | array, |
int | x, | ||
int | y, | ||
int | width, | ||
int | height, | ||
char * | c ) |
Draws a rectangle in a 2D String Array.
Like all methods in AnsiBuilder, this does not append anything to the string. You will need to input the full ANSI code, like "\033[31m" for red text.
array | The string array. |
x | The x coordinate. |
y | The y coordinate. |
width | The width of the rectangle. |
height | The height of the rectangle. |
c | The ANSI code to draw the rectangle with. |
int String2DBuilder_replaceAll | ( | char *** | array, |
char * | find, | ||
char * | replace ) |
Replaces all instances of an ANSI code in a 2D String Array.
array | The 2D String Array. |
find | The ANSI code to find. |
replace | The ANSI code to replace the found ANSI code with. |
int String2DBuilder_rotate | ( | char *** | array, |
double | radians ) |
Rotates a 2D String Array.
This method rotates a 2D String Array by a specific number of radians. The rotation will be done around the center of the 2D String Array.
array | The 2D String Array. |
radians | The number of radians to rotate. |
char *** String2DBuilder_scale | ( | char *** | array, |
double | scale ) |
Scales a 2D String Array.
This method scales a 2D String Array by a specific factor. The scaling will be done around the center of the 2D String Array.
The original 2D String Array will be freed.
array | The 2D String Array. |
scale | The factor to scale the 2D String Array by. |
int String2DBuilder_setAnsi | ( | char *** | array, |
int | x, | ||
int | y, | ||
char * | c ) |
Sets an ANSI code in a 2D String Array.
Like all methods in AnsiBuilder, this does not append anything to the string. You will need to input the full ANSI code, like "\033[31m" for red text.
This method sets an ANSI code at the specified x and y coordinates. If the x or y coordinate is out of bounds, the method will return -1.
The values at array[height]
will be set to 0 for null termination. It is advised that you create a char***
with this method and pass it to other functions presented in this header file, rather than create a char***
and pass it to other functions, in order to avoid undefined behavior.
array | The 2D String Array. |
x | The x coordinate. |
y | The y coordinate |
c | The ANSI code to set. |
char *** String2DBuilder_transpose | ( | char *** | array | ) |
Transposes a 2D String Array.
This method transposes a 2D String Array, then returns the transposed 2D String Array. The original 2D String Array will be freed.
array | The 2D String Array. |
int String2DBuilder_vFlip | ( | char *** | array | ) |
Flips a 2D String Array vertically.
array | The 2D String Array. |
int String2DBuilder_vLine | ( | char *** | array, |
int | x, | ||
int | y, | ||
int | height, | ||
char * | c ) |
Draws a vertical line in a 2D String Array.
Like all methods in AnsiBuilder, this does not append anything to the string. You will need to input the full ANSI code, like "\033[31m" for red text.
array | The string array. |
x | The x coordinate. |
y | The y coordinate. |
height | The height of the line. |
c | The ANSI to draw the line with. |