Sista v3.0.0-alpha.1
Sista is a C++ lightweight OS-agnostic library for terminal animations and videogames
Loading...
Searching...
No Matches
api.h
Go to the documentation of this file.
1
17#pragma once
18
19#include <stddef.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
34struct sista_Field;
36
53FieldHandler_t sista_createField(size_t, size_t);
74
86
124
132void sista_resetAnsi();
133
146 F_RED = 31,
149 F_BLUE = 34,
151 F_CYAN = 36,
152 F_WHITE = 37
166 B_RED = 41,
169 B_BLUE = 44,
171 B_CYAN = 46,
172 B_WHITE = 47
209 unsigned char red;
210 unsigned char green;
211 unsigned char blue;
212};
213
284
294struct sista_ANSISettings;
296
317 enum sista_Attribute);
342 struct sista_RGBColor,
343 enum sista_Attribute);
363
373struct sista_Border;
375
404
427
438 unsigned short y;
439 unsigned short x;
440};
441
451struct sista_Pawn;
452typedef struct sista_Pawn* PawnHandler_t;
453
477 struct sista_Coordinates);
501 struct sista_Coordinates);
502
519
560
561#ifdef __cplusplus
562}
563#endif
ANSISettingsHandler_t sista_createANSISettings(enum sista_ForegroundColor, enum sista_BackgroundColor, enum sista_Attribute)
Creates an ANSISettings object.
Definition: api.cpp:86
void sista_destroyField(FieldHandler_t)
Deallocates the Field from memory.
Definition: api.cpp:29
void sista_destroyANSISettings(ANSISettingsHandler_t)
Deallocates the ANSISettings from memory.
Definition: api.cpp:120
void sista_setBackgroundColorRGB(const struct sista_RGBColor *)
Sets the background color using an RGB color.
Definition: api.cpp:77
sista_Attribute
Text attributes for terminal text.
Definition: api.h:185
@ A_BLINK_FAST
Definition: api.h:192
@ A_RESET
Definition: api.h:186
@ A_HIDDEN
Definition: api.h:194
@ A_ITALIC
Definition: api.h:189
@ A_STRIKETHROUGH
Definition: api.h:195
@ A_FAINT
Definition: api.h:188
@ A_BLINK
Definition: api.h:191
@ A_REVERSE
Definition: api.h:193
@ A_UNDERLINE
Definition: api.h:190
@ A_BRIGHT
Definition: api.h:187
void sista_destroyBorder(BorderHandler_t)
Deallocates the Border from memory.
Definition: api.cpp:138
struct sista_Field * FieldHandler_t
Definition: api.h:35
void sista_setForegroundColor(enum sista_ForegroundColor)
Sets the foreground color using a predefined color.
Definition: api.cpp:57
sista_ForegroundColor
Predefined foreground colors for terminal text.
Definition: api.h:144
@ F_RED
Definition: api.h:146
@ F_GREEN
Definition: api.h:147
@ F_CYAN
Definition: api.h:151
@ F_WHITE
Definition: api.h:152
@ F_MAGENTA
Definition: api.h:150
@ F_BLACK
Definition: api.h:145
@ F_YELLOW
Definition: api.h:148
@ F_BLUE
Definition: api.h:149
struct sista_Border * BorderHandler_t
Definition: api.h:374
void sista_resetAttribute(enum sista_Attribute)
Resets a text attribute.
Definition: api.cpp:66
struct sista_ANSISettings * ANSISettingsHandler_t
Definition: api.h:295
ANSISettingsHandler_t sista_createANSISettingsRGB(struct sista_RGBColor, struct sista_RGBColor, enum sista_Attribute)
Creates an ANSISettings object.
int sista_movePawn(FieldHandler_t, PawnHandler_t, struct sista_Coordinates)
Moves the pawn to a new position.
Definition: api.cpp:189
struct sista_Pawn * PawnHandler_t
Definition: api.h:452
void sista_resetAnsi()
Resets ANSI settings to default.
Definition: api.cpp:54
void sista_printSwappableField(SwappableFieldHandler_t, char)
Prints the specified Field with a given border.
Definition: api.cpp:49
void sista_printSwappableFieldWithBorder(SwappableFieldHandler_t, BorderHandler_t)
Prints the field with the specified border.
Definition: api.cpp:146
FieldHandler_t sista_createField(size_t, size_t)
Creates a Field with the specified width and height.
Definition: api.cpp:20
void sista_setBackgroundColor(enum sista_BackgroundColor)
Sets the background color using a predefined color.
Definition: api.cpp:60
void sista_setAttribute(enum sista_Attribute)
Sets a text attribute.
Definition: api.cpp:63
struct sista_SwappableField * SwappableFieldHandler_t
Definition: api.h:85
void sista_printField(FieldHandler_t, char)
Prints the specified Field with a given border.
Definition: api.cpp:45
int sista_applySwaps(SwappableFieldHandler_t)
Executes all pending pawn swaps.
Definition: api.cpp:232
void sista_destroySwappableField(SwappableFieldHandler_t)
Deallocates the SwappableField from memory.
Definition: api.cpp:41
sista_BackgroundColor
Predefined background colors for terminal text.
Definition: api.h:164
@ B_BLACK
Definition: api.h:165
@ B_RED
Definition: api.h:166
@ B_WHITE
Definition: api.h:172
@ B_MAGENTA
Definition: api.h:170
@ B_GREEN
Definition: api.h:167
@ B_BLUE
Definition: api.h:169
@ B_YELLOW
Definition: api.h:168
@ B_CYAN
Definition: api.h:171
PawnHandler_t sista_createPawnInSwappableField(SwappableFieldHandler_t, char, ANSISettingsHandler_t, struct sista_Coordinates)
Creates a Pawn object in a given field.
Definition: api.cpp:151
PawnHandler_t sista_createPawnInField(FieldHandler_t, char, ANSISettingsHandler_t, struct sista_Coordinates)
Creates a Pawn object in a given field.
Definition: api.cpp:170
void sista_printFieldWithBorder(FieldHandler_t, BorderHandler_t)
Prints the field with the specified border.
Definition: api.cpp:142
BorderHandler_t sista_createBorder(char, ANSISettingsHandler_t)
Creates a Border object.
Definition: api.cpp:129
void sista_applyANSISettings(ANSISettingsHandler_t)
Applies the ANSI settings to the terminal.
Definition: api.cpp:124
int sista_addPawnToSwap(SwappableFieldHandler_t, PawnHandler_t, struct sista_Coordinates)
Adds the Pawn to a list of pawns to be moved ("swapped") later.
Definition: api.cpp:210
void sista_setForegroundColorRGB(const struct sista_RGBColor *)
Sets the foreground color using an RGB color.
Definition: api.cpp:69
SwappableFieldHandler_t sista_createSwappableField(size_t, size_t)
Creates a SwappableField with the specified width and height.
Definition: api.cpp:32
Opaque struct representing ANSI settings.
Opaque struct representing a Border object.
Represents a pair of coordinates (y, x).
Definition: api.h:437
unsigned short y
Definition: api.h:438
unsigned short x
Definition: api.h:439
Opaque struct representing a Field object.
Opaque struct representing a Pawn object.
Represents an RGB color with red, green, and blue components.
Definition: api.h:208
unsigned char blue
Definition: api.h:211
unsigned char red
Definition: api.h:209
unsigned char green
Definition: api.h:210
Opaque struct representing a SwappableField object.