cmdfx 0.2.0
Lightweight game engine for your terminal
Loading...
Searching...
No Matches
builder.h
Go to the documentation of this file.
1
11
12#pragma once
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18#pragma region Character Builder
19
20// Utility Functions - General (Character)
21
27int getCharArrayWidth(char** array);
28
34int getCharArrayHeight(char** array);
35
41char** createCharArrayCopy(char** array);
42
52char** Char2DBuilder_copy(char** array);
53
65int areCharArraysSameSize(char** array1, char** array2);
66
78int compareCharArrays(char** array1, char** array2);
79
88int printCharArray(char** array);
89
90// Core Functions (Character)
91
108char** Char2DBuilder_create(int width, int height);
109
127char** Char2DBuilder_createFilled(int width, int height, char c);
128
141int Char2DBuilder_setChar(char** array, int x, int y, char c);
142
156int Char2DBuilder_hLine(char** array, int x, int y, int width, char c);
157
171int Char2DBuilder_vLine(char** array, int x, int y, int height, char c);
172
187int Char2DBuilder_rect(char** array, int x, int y, int width, int height, char c);
188
199int Char2DBuilder_fillRect(char** array, int x, int y, int width, int height, char c);
200
207int Char2DBuilder_fill(char** array, char c);
208
218int Char2DBuilder_circle(char** array, int x, int y, int radius, char c);
219
229int Char2DBuilder_fillCircle(char** array, int x, int y, int radius, char c);
230
241int Char2DBuilder_ellipse(char** array, int x, int y, int xradius, int yradius, char c);
242
253int Char2DBuilder_fillEllipse(char** array, int x, int y, int xradius, int yradius, char c);
254
265int Char2DBuilder_line(char** array, int x1, int y1, int x2, int y2, char c);
266
282int Char2DBuilder_polygon(char** array, int x, int y, int sides, int radius, char c);
283
299int Char2DBuilder_fillPolygon(char** array, int x, int y, int sides, int radius, char c);
300
314int Char2DBuilder_text(char** array, int x, int y, char* text);
315
316// Utility Functions - Sizing
317
331int Char2DBuilder_resize(char** array, int width, int height);
332
347int Char2DBuilder_resizeWithPadding(char** array, int width, int height, char padding);
348
359int Char2DBuilder_center(char** array);
360
374int Char2DBuilder_resizeAndCenter(char** array, int width, int height);
375
376// Utility Functions - Transformation
377
388int Char2DBuilder_rotate(char** array, double radians);
389
402
409int Char2DBuilder_hFlip(char** array);
410
417int Char2DBuilder_vFlip(char** array);
418
429char** Char2DBuilder_transpose(char** array);
430
439int Char2DBuilder_replaceAll(char** array, char find, char replace);
440
453char** Char2DBuilder_scale(char** array, double scale);
454
455// Utility Functions - Gradient
456
506
527int Char2DBuilder_gradient(char** array, int x, int y, int width, int height, char start, char end, enum CmdFX_GradientDirection direction);
528
549int Char2DBuilder_multiGradient(char** array, int x, int y, int width, int height, int numChars, char* gradient, enum CmdFX_GradientDirection direction);
550
572int Char2DBuilder_multiGradients(char** array, int x, int y, int width, int height, int numChars, char* gradient, double* percentages, enum CmdFX_GradientDirection direction);
573
589int Char2DBuilder_gradientFull(char** array, char start, char end, enum CmdFX_GradientDirection direction);
590
607int Char2DBuilder_multiGradientFull(char** array, int numChars, char* gradient, enum CmdFX_GradientDirection direction);
608
626int Char2DBuilder_multiGradientsFull(char** array, int numChars, char* gradient, double* percentages, enum CmdFX_GradientDirection direction);
627
628#pragma endregion
629
630#pragma region ANSI Builder
631
632// Utility Functions - General (ANSI)
633
639int getStringArrayWidth(char*** array);
640
646int getStringArrayHeight(char*** array);
647
653char*** createStringArrayCopy(char*** array);
654
664int clearStringArray(char*** array);
665
677int areStringArraysSameSize(char*** array1, char*** array2);
678
690int compareStringArrays(char*** array1, char*** array2);
691
701int printStringArray(char*** array);
702
703// Core Functions (ANSI)
704
718char*** String2DBuilder_create(int width, int height);
719
734char*** String2DBuilder_createFilled(int width, int height, char* c);
735
757int String2DBuilder_setAnsi(char*** array, int x, int y, char* c);
758
772int String2DBuilder_hLine(char*** array, int x, int y, int width, char* c);
773
787int String2DBuilder_vLine(char*** array, int x, int y, int height, char* c);
788
803int String2DBuilder_rect(char*** array, int x, int y, int width, int height, char* c);
804
819int String2DBuilder_fillRect(char*** array, int x, int y, int width, int height, char* c);
820
821
832int String2DBuilder_fill(char*** array, char* c);
833
847int String2DBuilder_circle(char*** array, int x, int y, int radius, char* c);
848
862int String2DBuilder_fillCircle(char*** array, int x, int y, int radius, char* c);
863
878int String2DBuilder_ellipse(char*** array, int x, int y, int xradius, int yradius, char* c);
879
894int String2DBuilder_fillEllipse(char*** array, int x, int y, int xradius, int yradius, char* c);
895
910int String2DBuilder_line(char*** array, int x1, int y1, int x2, int y2, char* c);
911
930int String2DBuilder_polygon(char*** array, int x, int y, int sides, int radius, char* c);
931
950int String2DBuilder_fillPolygon(char*** array, int x, int y, int sides, int radius, char* c);
951
952// Utility Functions - Transformation (ANSI)
953
964int String2DBuilder_rotate(char*** array, double radians);
965
972int String2DBuilder_hFlip(char*** array);
973
980int String2DBuilder_vFlip(char*** array);
981
992char*** String2DBuilder_transpose(char*** array);
993
1002int String2DBuilder_replaceAll(char*** array, char* find, char* replace);
1003
1016char*** String2DBuilder_scale(char*** array, double scale);
1017
1018// Utility Functions - Gradients (ANSI)
1019
1039int String2DBuilder_gradientForeground(char*** array, int x, int y, int width, int height, int start, int end, enum CmdFX_GradientDirection direction);
1040
1060int String2DBuilder_gradientBackground(char*** array, int x, int y, int width, int height, int start, int end, enum CmdFX_GradientDirection direction);
1061
1082int String2DBuilder_multiGradientForeground(char*** array, int x, int y, int width, int height, int numColors, int* colors, enum CmdFX_GradientDirection direction);
1083
1104int String2DBuilder_multiGradientBackground(char*** array, int x, int y, int width, int height, int numColors, int* colors, enum CmdFX_GradientDirection direction);
1105
1127int String2DBuilder_multiGradientsForeground(char*** array, int x, int y, int width, int height, int numColors, int* colors, double* percentages, enum CmdFX_GradientDirection direction);
1128
1150int String2DBuilder_multiGradientsBackground(char*** array, int x, int y, int width, int height, int numColors, int* colors, double* percentages, enum CmdFX_GradientDirection direction);
1151
1168int String2DBuilder_gradientForegroundFull(char*** array, int start, int end, enum CmdFX_GradientDirection direction);
1169
1186int String2DBuilder_gradientBackgroundFull(char*** array, int start, int end, enum CmdFX_GradientDirection direction);
1187
1204int String2DBuilder_multiGradientForegroundFull(char*** array, int numColors, int* colors, enum CmdFX_GradientDirection direction);
1205
1222int String2DBuilder_multiGradientBackgroundFull(char*** array, int numColors, int* colors, enum CmdFX_GradientDirection direction);
1223
1241int String2DBuilder_multiGradientsForegroundFull(char*** array, int numColors, int* colors, double* percentages, enum CmdFX_GradientDirection direction);
1242
1260int String2DBuilder_multiGradientsBackgroundFull(char*** array, int numColors, int* colors, double* percentages, enum CmdFX_GradientDirection direction);
1261
1262#pragma endregion
1263
1264#ifdef __cplusplus
1265}
1266#endif
int String2DBuilder_gradientBackgroundFull(char ***array, int start, int end, enum CmdFX_GradientDirection direction)
Sets a background gradient in a 2D String Array.
int Char2DBuilder_vFlip(char **array)
Flips a 2D Character Array vertically.
CmdFX_GradientDirection
Represents a color gradient that can be applied .
Definition builder.h:464
@ GRADIENT_VERTICAL_REVERSE
A vertical gradient in reverse.
Definition builder.h:480
@ GRADIENT_ANGLE_45
A 45-degree gradient.
Definition builder.h:484
@ GRADIENT_ANGLE_225
A 225-degree gradient.
Definition builder.h:492
@ GRADIENT_HORIZONTAL
A horizontal gradient.
Definition builder.h:468
@ GRADIENT_ANGLE_135
A 135-degree gradient.
Definition builder.h:488
@ GRADIENT_RADIAL
A radial gradient.
Definition builder.h:500
@ GRADIENT_CONICAL
A conical gradient.
Definition builder.h:504
@ GRADIENT_ANGLE_315
A 315-degree gradient.
Definition builder.h:496
@ GRADIENT_VERTICAL
A vertical gradient.
Definition builder.h:476
@ GRADIENT_HORIZONTAL_REVERSE
A horizontal gradient in reverse.
Definition builder.h:472
int String2DBuilder_multiGradientBackgroundFull(char ***array, int numColors, int *colors, enum CmdFX_GradientDirection direction)
Sets a background gradient 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 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 String2DBuilder_rotate(char ***array, double radians)
Rotates a 2D String Array.
char ** Char2DBuilder_scale(char **array, double scale)
Scales a 2D Character Array.
int areCharArraysSameSize(char **array1, char **array2)
Checks if two 2D Character Arrays are the same size.
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_circle(char **array, int x, int y, int radius, char c)
Draws a circle in a 2D Character Array.
int clearStringArray(char ***array)
Clears a 2D String Array.
int Char2DBuilder_multiGradientFull(char **array, int numChars, char *gradient, enum CmdFX_GradientDirection direction)
Creates a multi-gradient in a 2D Character Array.
char *** String2DBuilder_scale(char ***array, double scale)
Scales 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 Char2DBuilder_fillCircle(char **array, int x, int y, int radius, char c)
Fills a circle in a 2D Character 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_replaceAll(char ***array, char *find, char *replace)
Replaces all instances of an ANSI code in a 2D String Array.
int String2DBuilder_setAnsi(char ***array, int x, int y, char *c)
Sets an ANSI code 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_polygon(char ***array, int x, int y, int sides, int radius, char *c)
Draws a polygon in a 2D String Array.
int areStringArraysSameSize(char ***array1, char ***array2)
Checks if two 2D String Arrays are the same size.
char ** Char2DBuilder_copy(char **array)
Copies a 2D Character Array.
int String2DBuilder_vFlip(char ***array)
Flips a 2D String Array vertically.
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_multiGradientForegroundFull(char ***array, int numColors, int *colors, enum CmdFX_GradientDirection direction)
Sets a foreground gradient 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 Char2DBuilder_hFlip(char **array)
Flips a 2D Character Array horizontally.
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_rotate(char **array, double radians)
Rotates a 2D Character 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_multiGradientsForegroundFull(char ***array, int numColors, int *colors, double *percentages, enum CmdFX_GradientDirection direction)
Sets a foreground gradient 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 compareStringArrays(char ***array1, char ***array2)
Compares two 2D String Arrays.
int printCharArray(char **array)
Prints a 2D Character Array.
int String2DBuilder_vLine(char ***array, int x, int y, int height, char *c)
Draws a vertical line in a 2D String Array.
int Char2DBuilder_replaceAll(char **array, char find, char replace)
Replaces all instances of a character in a 2D Character 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.
int Char2DBuilder_polygon(char **array, int x, int y, int sides, int radius, char c)
Draws a polygon in a 2D Character 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 Char2DBuilder_setChar(char **array, int x, int y, char c)
Sets a character in a 2D Character 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 Char2DBuilder_gradientFull(char **array, char start, char end, enum CmdFX_GradientDirection direction)
Creates a full gradient in a 2D Character Array.
char ** Char2DBuilder_create(int width, int height)
Creates a 2D Character Array with a specific width and height.
int printStringArray(char ***array)
Prints a 2D String 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 getStringArrayHeight(char ***array)
Gets the height of a 2D String 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 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 Char2DBuilder_vLine(char **array, int x, int y, int height, char c)
Draws a vertical line in a 2D Character 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.
int Char2DBuilder_fill(char **array, char c)
Fills the entire 2D Character 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.
char *** createStringArrayCopy(char ***array)
Creates a copy of a 2D String Array.
double Char2DBuilder_getRotationAngle(char **array)
Gets the rotation angle of a 2D Character 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.
char ** Char2DBuilder_transpose(char **array)
Transposes a 2D Character Array.
int String2DBuilder_gradientForegroundFull(char ***array, int start, int end, enum CmdFX_GradientDirection direction)
Sets a background gradient in a 2D String Array.
int Char2DBuilder_resize(char **array, int width, int height)
Resizes a 2D Character Array to a specific width and height.
int getStringArrayWidth(char ***array)
Gets the width of a 2D String 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 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.
char *** String2DBuilder_create(int width, int height)
Creates a 2D String Array with a specific width and height.
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 getCharArrayWidth(char **array)
Gets the width of a 2D Character Array.
int String2DBuilder_fillCircle(char ***array, int x, int y, int radius, char *c)
Fills a circle in a 2D String 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 compareCharArrays(char **array1, char **array2)
Compares two 2D Character Arrays.
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 Char2DBuilder_resizeAndCenter(char **array, int width, int height)
Resizes and centers 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.
char *** String2DBuilder_transpose(char ***array)
Transposes a 2D String 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_text(char **array, int x, int y, char *text)
Writes text in 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.
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_center(char **array)
Centers a 2D Character Array.
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 String2DBuilder_hFlip(char ***array)
Flips a 2D String Array horizontally.