This documentation describes the Prokee module interface.
Static Methods:
main
int tio::main(int argc,char **argv)
createContext
struct tio_screen *tio::createContext(const char *name,struct tio_color sfgc,struct tio_color sbgc,struct tio_color fgc,struct tio_color bgc)
createScreen
struct tio_screen *tio::createScreen(struct tio_screen *context,const char *screen_title,int x,int y,int xx,int yy)
createWindow
struct tio_screen *tio::createWindow(struct tio_screen *screen,const char *window_title,int x,int y,int xx,int yy)
destroy
void tio::destroy(struct tio_screen *screen)
fitWindowToParent
void tio::fitWindowToParent(struct tio_screen *window,bool reallocBuffer)
draw
void tio::draw(struct tio_screen *screen)
drawContext
void tio::drawContext(struct tio_screen *context)
drawWindow
void tio::drawWindow(struct tio_screen *window)
locate
void tio::locate(struct tio_screen *window,int px,int py)
printString (version 3)
void tio::printString(struct tio_screen *window,int px,int py,const char *str,struct tio_color fg,struct tio_color bg)
updateDisplay
void tio::updateDisplay(struct tio_screen *context)
redim_plain
void tio::redim_plain(struct tio_screen *window,int xx,int yy)
Motivation
This module provides some convenience functions for interactive terminal applications to print colored unicode characters to the terminal as well as drawing text-based elements like "windows" and "screens" to the terminal. The module also provides some functions to read user input (from standard input) on a character by character basis (which allows waiting for the next character input). The module is intended to be used under Linux. It has been tested with the xfce4-terminal. Even though the module also compiles for Windows, it does not provide Unicode support and ANSI escape sequences (for colored output). There were no intentions from the author to implement equivalent functionality for the standard windows command prompt (Windows Console) due to lack of full Unicode support. According to Wikipedia this has changed: "As of the Windows 10 October 2018 update, the Windows Console has full Unicode support."
Static Methods
getLines
Returns the number of lines of the console window.
Signature:
int tio::getLines()
Return value:Number of lines.
getColumns
Returns the number of columns of the console window.
Signature:
int tio::getColumns()
Return value:Number of columns.
startup
Performs initialization for tio functions.
Call this function before calling any other tio functions.
Function tio::cleanup() should be called after using tio.
Signature:
bool tio::startup()
Return value:Returns true.
cleanup
Performs cleanup for tio.
The function restores the console to the previous mode.
Signature:
bool tio::cleanup()
Return value:Returns true.
scan_key
Returns the next input character or pressed key (or combination of keys).
If the input buffer is empty, the function waits until the user presses a key.
Signature:
int tio::scan_key()
Return value:The character or key.
main
Prints a demo screen.
Signature:
int tio::main(int argc,char **argv)
Parameters:
| int | argc | | The number of command-line parameters. |
| char ** | argv | [IN] | The command-line parameters. |
Return value:Exit status.
createContext
Constructs a new display context.
...
Signature:
struct tio_screen *tio::createContext(const char *name,struct tio_color sfgc,struct tio_color sbgc,struct tio_color fgc,struct tio_color bgc)
Parameters:
| const char * | name | [IN] | The null-terminated name of the context. |
| struct tio_color | sfgc | | The standard foreground color of selected elements. |
| struct tio_color | sbgc | | The standard background color of selected elements. |
| struct tio_color | fgc | | The standard foreground color. |
| struct tio_color | bgc | | The standard background color. |
Return value:Pointer to the context.
createScreen
Constructs a new screen.
...
Signature:
struct tio_screen *tio::createScreen(struct tio_screen *context,const char *screen_title,int x,int y,int xx,int yy)
Parameters:
| struct tio_screen * | context | [IN/OUT] | ... |
| const char * | screen_title | [IN] | The null-terminated title-text of the screen. |
| int | x | | |
| int | y | | |
| int | xx | | |
| int | yy | | |
Return value:Pointer to the screen.
createWindow
Constructs a new window.
...
Signature:
struct tio_screen *tio::createWindow(struct tio_screen *screen,const char *window_title,int x,int y,int xx,int yy)
Parameters:
| struct tio_screen * | screen | [IN/OUT] | ... |
| const char * | window_title | [IN] | The null-terminated title-text of the window. |
| int | x | | |
| int | y | | |
| int | xx | | |
| int | yy | | |
Return value:Pointer to the window.
destroy
Destructs a context, screen or window (and all its sub-screens and sub-windows).
Call this function on the context (the root window) to free resources of all windows in the window tree.
Signature:
void tio::destroy(struct tio_screen *screen)
Parameters:
| struct tio_screen * | screen | [IN] | a context, screen or window |
fitContextToTerminalSize
...
Signature:
void tio::fitContextToTerminalSize(struct tio_screen *context)
Parameters:
| struct tio_screen * | context | [IN/OUT] | ... |
fitScreenToTerminalSize
...
Signature:
void tio::fitScreenToTerminalSize(struct tio_screen *screen,bool reallocBuffer)
Parameters:
| struct tio_screen * | screen | [IN/OUT] | ... |
| bool | reallocBuffer | | ... |
fitWindowToParent
...
Signature:
void tio::fitWindowToParent(struct tio_screen *window,bool reallocBuffer)
Parameters:
| struct tio_screen * | window | [IN/OUT] | ... |
| bool | reallocBuffer | | ... |
reallocBufferToWindowSize
...
Signature:
void tio::reallocBufferToWindowSize(struct tio_screen *window)
Parameters:
| struct tio_screen * | window | [IN/OUT] | ... |
draw
Draws the screen, context or window.
Signature:
void tio::draw(struct tio_screen *screen)
Parameters:
| struct tio_screen * | screen | [IN/OUT] | ... |
drawContext
Draws the context.
Signature:
void tio::drawContext(struct tio_screen *context)
Parameters:
| struct tio_screen * | context | [IN/OUT] | ... |
drawWindow
Draws the screen or window.
Signature:
void tio::drawWindow(struct tio_screen *window)
Parameters:
| struct tio_screen * | window | [IN/OUT] | ... |
locate
Positions the window cursor.
Signature:
void tio::locate(struct tio_screen *window,int px,int py)
Parameters:
| struct tio_screen * | window | [IN/OUT] | ... |
| int | px | | Column number. |
| int | py | | Line number. |
printString (version 1)
Prints a string within a window at the current cursor location.
Signature:
void tio::printString(struct tio_screen *window,const char *str)
Parameters:
| struct tio_screen * | window | [IN/OUT] | ... |
| const char * | str | | A null-terminated string. |
printString (version 2)
Prints a string within a window at column px and line py.
Signature:
void tio::printString(struct tio_screen *window,int px,int py,const char *str)
Parameters:
| struct tio_screen * | window | [IN/OUT] | ... |
| int | px | | Column number. |
| int | py | | Line number. |
| const char * | str | | A null-terminated string. |
printString (version 3)
Prints a string within a window at a given location with given colors.
Signature:
void tio::printString(struct tio_screen *window,int px,int py,const char *str,struct tio_color fg,struct tio_color bg)
Parameters:
| struct tio_screen * | window | [IN/OUT] | ... |
| int | px | | Column number. |
| int | py | | Line number. |
| const char * | str | | A null-terminated string. |
| struct tio_color | fg | | The foreground color. |
| struct tio_color | bg | | The background color. |
updateDisplay
Updates the display.
Signature:
void tio::updateDisplay(struct tio_screen *context)
Parameters:
| struct tio_screen * | context | [IN/OUT] | ... |
redim_plain
...
Signature:
void tio::redim_plain(struct tio_screen *window,int xx,int yy)
Parameters:
| struct tio_screen * | window | [IN/OUT] | ... |
| int | xx | | |
| int | yy | | |
reset
Resets the display.
Signature:
void tio::reset()