diff options
| author | roy <[email protected]> | 2026-07-03 18:56:13 +0300 |
|---|---|---|
| committer | roy <[email protected]> | 2026-07-03 18:56:13 +0300 |
| commit | 0543331a79d884fb3e67676c079a244df5b1c337 (patch) | |
| tree | 1616dc0051656ca074f4c6ede5d7f8c96f7e61c3 /terminal-game-utils.hpp | |
| parent | f3f7c3157c887380781ce15d892ccb39a43456bc (diff) | |
Added option to make cursor visible and invisible. Automatically makes cursor visible at program exit.
Diffstat (limited to 'terminal-game-utils.hpp')
| -rw-r--r-- | terminal-game-utils.hpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/terminal-game-utils.hpp b/terminal-game-utils.hpp index 189a7de..d7d9522 100644 --- a/terminal-game-utils.hpp +++ b/terminal-game-utils.hpp @@ -187,4 +187,12 @@ inline void LeaveGameBuffer() { std::cout << "\033[?1049l"; } inline void MoveCursor(int row, int col) { std::cout << "\033[" << (row + 1) << ";" << (col + 1) << "H" << std::flush; } + +inline void MakeCursorVisible() { std::cout << "\033[?25h"; } + +inline void MakeCursorInvisible() { + std::cout << "\033[?25l"; + atexit(MakeCursorVisible); +} + }; // namespace tgu |
