An extremely basic VT100 terminal interface. This will generate the proper escape codes to do things such as moving the cursor and clearing the screen. It takes up practically no resources and is really just a nice short cut to avoid figuring out the escape codes yourself.
Dependents: JOGO_CORRIDA Snake mbedbreakingout
TermControl Class Reference
A simple class for sending VT100 terminal escape codes for handling things such as moving the cursor and clearing the screen. More...
#include <TermControl.h>
Public Member Functions | |
TermControl (Stream *term) | |
term The stream to send the escape codes to | |
void | Reset () |
Resets the terminal to defaults. | |
void | Clear () |
Clears the screen. | |
void | PrintAt (int x, int y, string s) |
Prints the specified string at coordinates x,y The cursor position is not changed. | |
char | GetChar () |
Get a character from the terminal stream. | |
void | SetCursor (int x, int y) |
Sets the cursor's position to x,y. | |
void | ResetCursor () |
Resets the cursor to (0,0), the top left hand corner of the screen. | |
void | SaveCursor () |
Saves the cursor on the display-side. | |
void | RestoreCursor () |
Restores the cursor on the display-side. | |
void | EnableScrolling (int begin, int end) |
Enables a scrolling "window" at the specified beginning and ending rows. | |
void | ScrollDown () |
Scrolls down the scrolling "window" by 1 line. | |
void | ScrollUp () |
Scrolls up the scrolling "window" by 1 line. | |
void | EraseLine () |
Erases the current line the cursor is on. | |
void | Print (string s) |
Prints the specified string to the string at the current cursor position. |
Detailed Description
A simple class for sending VT100 terminal escape codes for handling things such as moving the cursor and clearing the screen.
Definition at line 10 of file TermControl.h.
Constructor & Destructor Documentation
TermControl | ( | Stream * | term ) |
term The stream to send the escape codes to
Definition at line 19 of file TermControl.h.
Member Function Documentation
void Clear | ( | ) |
Clears the screen.
Definition at line 40 of file TermControl.h.
void EnableScrolling | ( | int | begin, |
int | end | ||
) |
Enables a scrolling "window" at the specified beginning and ending rows.
- Parameters:
-
begin The beginning row end The ending row
Definition at line 96 of file TermControl.h.
void EraseLine | ( | ) |
Erases the current line the cursor is on.
Definition at line 114 of file TermControl.h.
char GetChar | ( | ) |
Get a character from the terminal stream.
Definition at line 62 of file TermControl.h.
void Print | ( | string | s ) |
Prints the specified string to the string at the current cursor position.
Definition at line 120 of file TermControl.h.
void PrintAt | ( | int | x, |
int | y, | ||
string | s | ||
) |
Prints the specified string at coordinates x,y The cursor position is not changed.
- Parameters:
-
x The X coordinate, or column y The Y coordinate, or row s The string to print
Definition at line 51 of file TermControl.h.
void Reset | ( | ) |
Resets the terminal to defaults.
Definition at line 34 of file TermControl.h.
void ResetCursor | ( | ) |
Resets the cursor to (0,0), the top left hand corner of the screen.
Definition at line 74 of file TermControl.h.
void RestoreCursor | ( | ) |
Restores the cursor on the display-side.
It can only remember and store one cursor position at a time. ie, this can't be nested
Definition at line 88 of file TermControl.h.
void SaveCursor | ( | ) |
Saves the cursor on the display-side.
It can only remember one cursor position at a time. ie, this can't be nested
Definition at line 81 of file TermControl.h.
void ScrollDown | ( | ) |
Scrolls down the scrolling "window" by 1 line.
Note, EnableScrolling is required before this can be called
Definition at line 102 of file TermControl.h.
void ScrollUp | ( | ) |
Scrolls up the scrolling "window" by 1 line.
Note, EnableScrolling is required before this can be called
Definition at line 108 of file TermControl.h.
void SetCursor | ( | int | x, |
int | y | ||
) |
Sets the cursor's position to x,y.
Definition at line 68 of file TermControl.h.
Generated on Tue Jul 12 2022 20:44:35 by 1.7.2