Sista v3.0.0-alpha.1
Sista is a C++ lightweight OS-agnostic library for terminal animations and videogames
|
Manages terminal cursor operations. More...
#include <cursor.hpp>
Public Member Functions | |
Cursor () | |
Constructor that hides the cursor and clears the screen. | |
~Cursor () | |
Destructor that shows the cursor and resets ANSI settings. | |
void | goTo (unsigned short int, unsigned short int) const |
Moves the cursor to the specified (y, x) coordinates. | |
void | goTo (sista::Coordinates) const |
Moves the cursor to the specified Coordinates. | |
void | eraseScreen (EraseScreen) const |
Erases parts of the screen based on the specified EraseScreen option. | |
void | eraseLine (EraseLine, bool=true) const |
Erases parts of the current line based on the specified EraseLine option. | |
void | move (MoveCursor, unsigned short int) const |
Moves the cursor in the specified direction by a given number of positions. | |
void | move (MoveCursorDEC) const |
Moves the cursor using DEC-specific commands. | |
void | move (MoveCursorSCO) const |
Moves the cursor using SCO-specific commands. | |
Manages terminal cursor operations.
The Cursor struct provides methods to manipulate the terminal cursor, including moving to specific coordinates, erasing parts of the screen or line, and moving the cursor in various directions. It also handles hiding and showing the cursor upon creation and destruction.
sista::Cursor::Cursor | ( | ) |
Constructor that hides the cursor and clears the screen.
sista::Cursor::~Cursor | ( | ) |
Destructor that shows the cursor and resets ANSI settings.
void sista::Cursor::eraseLine | ( | EraseLine | eraseLine_, |
bool | moveCursor = true |
||
) | const |
Erases parts of the current line based on the specified EraseLine option.
eraseLine_ | The EraseLine option specifying which part of the line to erase. |
moveCursor | If true, moves the cursor to the beginning of the line after erasure. |
This method outputs the appropriate ANSI escape code to erase parts of the current line according to the selected option from the EraseLine enum. If moveCursor is true, it also moves the cursor to the start of the line after performing the erasure.
void sista::Cursor::eraseScreen | ( | EraseScreen | eraseScreen_ | ) | const |
Erases parts of the screen based on the specified EraseScreen option.
eraseScreen_ | The EraseScreen option specifying which part of the screen to erase. |
This method outputs the appropriate ANSI escape code to erase parts of the terminal screen according to the selected option from the EraseScreen enum.
void sista::Cursor::goTo | ( | sista::Coordinates | coordinates_ | ) | const |
Moves the cursor to the specified Coordinates.
coordinates_ | A Coordinates instance specifying the (y, x) position. |
void sista::Cursor::goTo | ( | unsigned short int | y_, |
unsigned short int | x_ | ||
) | const |
Moves the cursor to the specified (y, x) coordinates.
y_ | The y coordinate (row). |
x_ | The x coordinate (column). |
void sista::Cursor::move | ( | MoveCursor | moveCursor_, |
unsigned short int | n = 1 |
||
) | const |
Moves the cursor in the specified direction by a given number of positions.
moveCursor_ | The MoveCursor direction to move the cursor. |
n | The number of positions to move the cursor (default is 1). |
This method outputs the appropriate ANSI escape code to move the terminal cursor in the specified direction by the given number of positions.
void sista::Cursor::move | ( | MoveCursorDEC | moveCursorDEC_ | ) | const |
Moves the cursor using DEC-specific commands.
moveCursorDEC_ | The MoveCursorDEC command to execute (save or restore cursor position). |
This method outputs the appropriate ANSI escape code to save or restore the cursor position using DEC-specific commands.
void sista::Cursor::move | ( | MoveCursorSCO | moveCursorSCO_ | ) | const |
Moves the cursor using SCO-specific commands.
moveCursorSCO_ | The MoveCursorSCO command to execute (save or restore cursor position). |
This method outputs the appropriate ANSI escape code to save or restore the cursor position using SCO-specific commands.