|
Sista v3.0.0-beta.10
C++ lightweight OS-agnostic library for terminal animations and videogames
|
Class representing a terminal cursor for movement operations. More...
#include <cursor.hpp>

Public Member Functions | |
| Cursor () | |
| Constructor that hides the cursor. | |
| ~Cursor () | |
| Destructor that shows the cursor. | |
| 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. | |
| Cursor | __new__ (cls) |
| None | __init__ (self) |
| Create and return a Cursor wrapper object. | |
| None | move (self, int direction, int amount) |
| Move the cursor in the specified direction by the given amount. | |
| None | go_to (self, int y, int x) |
| Move the cursor to the absolute (y, x) position. | |
| None | go_to_coordinates (self, Capsule coords) |
| Move the cursor to the position described by a Coordinates capsule. | |
Class representing a terminal cursor for movement operations.
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.
| sista::Cursor::~Cursor | ( | ) |
Destructor that shows the cursor.
| None sista.Cursor.__init__ | ( | self | ) |
Create and return a Cursor wrapper object.
The returned object is a Python wrapper that owns the underlying C Cursor handler. Use the instance methods (move, go_to, go_to_coordinates) on the returned Cursor object. The wrapper manages the C-side lifetime (it will destroy the C handler when the Python object is deallocated).
| Cursor sista.Cursor.__new__ | ( | cls | ) |
| 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.
| None sista.Cursor.go_to | ( | self, | |
| int | y, | ||
| int | x | ||
| ) |
Move the cursor to the absolute (y, x) position.
:param y: Row index to move to. :param x: Column index to move to.
| None sista.Cursor.go_to_coordinates | ( | self, | |
| Capsule | coords | ||
| ) |
Move the cursor to the position described by a Coordinates capsule.
:param coords: Capsule returned by create_coordinates.
| 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.
| None sista.Cursor.move | ( | self, | |
| int | direction, | ||
| int | amount | ||
| ) |
Move the cursor in the specified direction by the given amount.
:param direction: One of the DIRECTION_* constants (or equivalent). :param amount: Number of positions to move the cursor.