Sista v3.0.0-alpha.1
Sista is a C++ lightweight OS-agnostic library for terminal animations and videogames
|
Sista library namespace. More...
Classes | |
struct | ANSISettings |
Represents a set of ANSI settings including colors and attributes. More... | |
class | Border |
Represents a brick of the border with a symbol and ANSI settings. More... | |
struct | Coordinates |
Represents 2D coordinates with x and y values. More... | |
struct | Cursor |
Manages terminal cursor operations. More... | |
class | Field |
Represents a 2D grid where Pawns can be placed, moved, and managed. More... | |
struct | Path |
Represents a movement path for a Pawn, including priority handling. More... | |
class | Pawn |
Represents an object on the field with a symbol, coordinates, and ANSI settings. More... | |
struct | RGBColor |
Represents an RGB color with red, green, and blue components in True Color (24-bit). More... | |
class | SwappableField |
A specialized Field that handles Pawn swaps without conflicts. More... | |
Enumerations | |
enum class | ForegroundColor : int { BLACK = 30 , RED = 31 , GREEN = 32 , YELLOW = 33 , BLUE = 34 , MAGENTA = 35 , CYAN = 36 , WHITE = 37 } |
Enumeration of foreground colors for ANSI escape codes. More... | |
enum class | BackgroundColor : int { BLACK = 40 , RED = 41 , GREEN = 42 , YELLOW = 43 , BLUE = 44 , MAGENTA = 45 , CYAN = 46 , WHITE = 47 } |
Enumeration of background colors for ANSI escape codes. More... | |
enum class | Attribute : int { RESET = 0 , BRIGHT = 1 , FAINT = 2 , ITALIC = 3 , UNDERSCORE = 4 , BLINK = 5 , RAPID_BLINK = 6 , REVERSE = 7 , HIDDEN = 8 , STRIKETHROUGH = 9 } |
Enumeration of text attributes for ANSI escape codes. More... | |
enum class | ScreenMode : int { MONOCROME_TEXT_40_25 = 0 , COLOR_TEXT_40_25 = 1 , MONOCROME_TEXT_80_25 = 2 , COLOR_TEXT_80_25 = 3 , FOUR_COLORS_GRAPHICS_320_200 = 4 , MONOCROME_GRAPHICS_320_200 = 5 , MONOCROME_GRAPHICS_640_200 = 6 , LINE_WRAPPING = 7 , COLOR_GRAPHICS_320_200 = 13 , COLOR_16_COLORS_GRAPHICS_640_200 = 14 , MONOCROME_2_COLORS_GRAPHICS_640_350 = 15 , COLOR_16_COLORS_GRAPHICS_640_350 = 16 , MONOCROME_2_COLORS_GRAPHICS_640_480 = 17 , COLOR_16_COLORS_GRAPHICS_640_480 = 18 , COLOR_256_COLORS_GRAPHICS_320_200 = 19 } |
Represents various ANSI screen modes. More... | |
enum class | EraseScreen : int { FROM_CURSOR_TO_END = 0 , FROM_CURSOR_TO_BEGINNING = 1 , ENTIRE_SCREEN = 2 , ERASE_SAVED_LINES = 3 } |
Enumeration for screen erasure options in ANSI escape codes. More... | |
enum class | EraseLine : int { LINE_FROM_CURSOR_TO_END = 0 , LINE_FROM_CURSOR_TO_BEGINNING = 1 , ENTIRE_LINE = 2 } |
Enumeration for line erasure options in ANSI escape codes. More... | |
enum class | MoveCursor : char { UP = 'A' , DOWN = 'B' , RIGHT = 'C' , LEFT = 'D' , BEGINNING_OF_NEXT_LINE = 'E' , BEGINNING_OF_PREVIOUS_LINE = 'F' , HORIZONTAL_ABSOLUTE = 'G' } |
Enumeration for cursor movement directions in ANSI escape codes. More... | |
enum class | MoveCursorDEC : int { SAVE_CURSOR_POSITION = 7 , RESTORE_CURSOR_POSITION = 8 } |
Enumeration for DEC-specific cursor movement commands in ANSI escape codes. More... | |
enum class | MoveCursorSCO : char { SCO_SAVE_CURSOR_POSITION = 's' , SCO_RESTORE_CURSOR_POSITION = 'u' } |
Enumeration for SCO-specific cursor movement commands in ANSI escape codes. More... | |
enum class | Effect { PACMAN = 0 , MATRIX = 1 } |
Enumeration for handling out-of-bounds coordinates. More... | |
Functions | |
void | setForegroundColor (ForegroundColor) |
Sets the foreground color using a predefined ForegroundColor enum. | |
void | setBackgroundColor (BackgroundColor) |
Sets the background color using a predefined BackgroundColor enum. | |
void | setAttribute (Attribute) |
Sets a text attribute using a predefined Attribute enum. | |
void | resetAttribute (Attribute) |
Resets a text attribute using a predefined Attribute enum. | |
void | resetAnsi () |
Resets all ANSI settings to default values. | |
void | setForegroundColor (const RGBColor &) |
Sets the foreground color using an RGBColor struct. | |
void | setBackgroundColor (const RGBColor &) |
Sets the background color using an RGBColor struct. | |
void | setForegroundColor (unsigned short int, unsigned short int, unsigned short int) |
Sets the foreground color using RGB values. | |
void | setBackgroundColor (unsigned short int, unsigned short int, unsigned short int) |
Sets the background color using RGB values. | |
void | setForegroundColor (unsigned short int) |
Sets the foreground color using a 256-color palette index. | |
void | setBackgroundColor (unsigned short int) |
Sets the background color using a 256-color palette index. | |
void | setScreenMode (ScreenMode) |
Sets a specific screen mode. | |
void | unsetScreenMode (ScreenMode) |
Unsets a specific screen mode. | |
void | clearScreen (bool spaces=true) |
Clears the terminal screen and optionally the scrollback buffer. | |
const char * | getVersion () |
Returns the Sista library version as a string. | |
int | getVersionMajor () |
Returns the major version number of the Sista library. | |
int | getVersionMinor () |
Returns the minor version number of the Sista library. | |
int | getVersionPatch () |
Returns the patch version number of the Sista library. | |
Sista library namespace.
This namespace encapsulates all components of the Sista library.
|
strong |
Enumeration of text attributes for ANSI escape codes.
This enum class defines various text attributes that can be used in ANSI escape codes. Each attribute is associated with its corresponding ANSI code value, ranging from 0 to 9.
Enumerator | |
---|---|
RESET | |
BRIGHT | |
FAINT | |
ITALIC | |
UNDERSCORE | |
BLINK | |
RAPID_BLINK | |
REVERSE | |
HIDDEN | |
STRIKETHROUGH |
|
strong |
|
strong |
Enumeration for handling out-of-bounds coordinates.
This enum class defines different effects that can be applied when a Pawn's coordinates go out of the bounds of the Field. The effects determine how the coordinates are adjusted to bring them back within valid limits.
Enumerator | |
---|---|
PACMAN | |
MATRIX |
|
strong |
Enumeration for line erasure options in ANSI escape codes.
This enum class defines various options for erasing parts of the current line in the terminal using ANSI escape codes. Each option corresponds to a specific ANSI code value.
Enumerator | |
---|---|
LINE_FROM_CURSOR_TO_END | |
LINE_FROM_CURSOR_TO_BEGINNING | Erase from the cursor position to the end of the line. |
ENTIRE_LINE | Erase from the cursor position to the beginning of the line. |
|
strong |
Enumeration for screen erasure options in ANSI escape codes.
This enum class defines various options for erasing parts of the terminal screen using ANSI escape codes. Each option corresponds to a specific ANSI code value.
|
strong |
|
strong |
Enumeration for cursor movement directions in ANSI escape codes.
This enum class defines various directions for moving the terminal cursor using ANSI escape codes. Each direction corresponds to a specific command character used in the escape sequences.
Enumerator | |
---|---|
UP | |
DOWN | |
RIGHT | |
LEFT | |
BEGINNING_OF_NEXT_LINE | |
BEGINNING_OF_PREVIOUS_LINE | |
HORIZONTAL_ABSOLUTE |
|
strong |
Enumeration for DEC-specific cursor movement commands in ANSI escape codes.
This enum class defines specific commands for saving and restoring the cursor position using DEC (Digital Equipment Corporation) ANSI escape codes. Each command corresponds to a specific ANSI code value.
Enumerator | |
---|---|
SAVE_CURSOR_POSITION | |
RESTORE_CURSOR_POSITION |
|
strong |
Enumeration for SCO-specific cursor movement commands in ANSI escape codes.
This enum class defines specific commands for saving and restoring the cursor position using SCO (Santa Cruz Operation) ANSI escape codes. Each command corresponds to a specific command character used in the escape sequences.
Enumerator | |
---|---|
SCO_SAVE_CURSOR_POSITION | |
SCO_RESTORE_CURSOR_POSITION |
|
strong |
Represents various ANSI screen modes.
This enum defines different screen modes that can be set or unset using ANSI escape codes. Each mode corresponds to a specific configuration of text and graphics display.
void sista::clearScreen | ( | bool | spaces = true | ) |
Clears the terminal screen and optionally the scrollback buffer.
spaces | If true, clears both the screen and the scrollback buffer; if false, only moves the cursor to the top-left corner. |
This function outputs ANSI escape codes to clear the terminal screen. If the spaces
parameter is set to true, it also clears the scrollback buffer. After clearing, it moves the cursor to the top-left corner of the terminal.
spaces
to false.
|
inline |
Returns the Sista library version as a string.
This function returns the version of the Sista library in the format "MAJOR.MINOR.PATCH". It is useful for logging, debugging, or displaying version information in applications that utilize the Sista library.
|
inline |
Returns the major version number of the Sista library.
This function returns the major version number of the Sista library. The major version typically indicates significant changes or milestones in the library's development.
|
inline |
Returns the minor version number of the Sista library.
This function returns the minor version number of the Sista library. The minor version typically indicates the addition of new features or improvements that are backward-compatible.
|
inline |
Returns the patch version number of the Sista library.
This function returns the patch version number of the Sista library. The patch version typically indicates bug fixes or minor changes that do not affect the overall functionality or compatibility of the library.
void sista::resetAnsi | ( | ) |
Resets all ANSI settings to default values.
This function resets the terminal's text attributes, foreground color, and background color to their default values. It outputs the corresponding ANSI escape codes to standard output.
Default settings are:
void sista::resetAttribute | ( | Attribute | ) |
Resets a text attribute using a predefined Attribute enum.
attribute | The Attribute to reset. |
This function resets the terminal's text attribute based on the provided Attribute enum value. It outputs the corresponding ANSI escape code to standard output.
void sista::setAttribute | ( | Attribute | ) |
Sets a text attribute using a predefined Attribute enum.
attribute | The Attribute to set. |
This function sets the terminal's text attribute based on the provided Attribute enum value. It outputs the corresponding ANSI escape code to standard output.
void sista::setBackgroundColor | ( | BackgroundColor | ) |
Sets the background color using a predefined BackgroundColor enum.
color | The BackgroundColor to set. |
This function sets the terminal's background color based on the provided BackgroundColor enum value. It outputs the corresponding ANSI escape code to standard output.
void sista::setBackgroundColor | ( | const RGBColor & | ) |
Sets the background color using an RGBColor struct.
rgbcolor | The RGBColor to set. |
This function sets the terminal's background color based on the provided RGBColor struct. It extracts the red, green, and blue components and calls the appropriate function to set the color using RGB values.
void sista::setBackgroundColor | ( | unsigned short int | ) |
Sets the background color using a 256-color palette index.
color | The color index (0-255). |
This function sets the terminal's background color based on the provided 256-color palette index. It outputs the corresponding ANSI escape code to standard output.
void sista::setBackgroundColor | ( | unsigned short int | , |
unsigned short int | , | ||
unsigned short int | |||
) |
Sets the background color using RGB values.
red | The red component (0-255). |
green | The green component (0-255). |
blue | The blue component (0-255). |
This function sets the terminal's background color based on the provided RGB values. It outputs the corresponding ANSI escape code to standard output.
void sista::setForegroundColor | ( | const RGBColor & | ) |
Sets the foreground color using an RGBColor struct.
rgbcolor | The RGBColor to set. |
This function sets the terminal's foreground color based on the provided RGBColor struct. It extracts the red, green, and blue components and calls the appropriate function to set the color using RGB values.
void sista::setForegroundColor | ( | ForegroundColor | ) |
Sets the foreground color using a predefined ForegroundColor enum.
color | The ForegroundColor to set. |
This function sets the terminal's foreground color based on the provided ForegroundColor enum value. It outputs the corresponding ANSI escape code to standard output.
void sista::setForegroundColor | ( | unsigned short int | ) |
Sets the foreground color using a 256-color palette index.
color | The color index (0-255). |
This function sets the terminal's foreground color based on the provided 256-color palette index. It outputs the corresponding ANSI escape code to standard output.
void sista::setForegroundColor | ( | unsigned short int | , |
unsigned short int | , | ||
unsigned short int | |||
) |
Sets the foreground color using RGB values.
red | The red component (0-255). |
green | The green component (0-255). |
blue | The blue component (0-255). |
This function sets the terminal's foreground color based on the provided RGB values. It outputs the corresponding ANSI escape code to standard output.
void sista::setScreenMode | ( | ScreenMode | ) |
Sets a specific screen mode.
mode | The ScreenMode to set. |
This function sets the terminal's screen mode based on the provided ScreenMode enum value. It outputs the corresponding ANSI escape code to standard output.
void sista::unsetScreenMode | ( | ScreenMode | ) |
Unsets a specific screen mode.
mode | The ScreenMode to unset. |
This function unsets the terminal's screen mode based on the provided ScreenMode enum value. It outputs the corresponding ANSI escape code to standard output.