The libt3window library provides functions for manipulating the terminal and for creating (possibly overlapping) windows on a terminal. libt3window can be used instead of (n)curses for drawing on the terminal. libt3window provides the following features:
The example below shows a small program which displays two overlapping windows. When the user presses a key the front window is hidden, showing the previously partially obscured window. To make the windows clearly visable a box is drawn around each window.
#include <stdlib.h>
#include <stdio.h>
#include <t3/window.h>
int main(int argc, char *argv[]) {
int result;
exit(EXIT_FAILURE);
}
if (hidden == NULL || exposed == NULL) {
fprintf(stderr, "Not enough memory available for creating windows\n");
exit(EXIT_FAILURE);
}
exit(EXIT_SUCCESS);
}
int t3_term_init(int fd, const char *term)
Initialize the terminal.
Definition: terminal_init.c:654
const char * t3_window_strerror(int error)
Get a string description for an error code.
Definition: misc.c:41
void t3_term_restore(void)
Restore terminal state (de-initialize).
Definition: terminal_init.c:838
#define T3_ERR_SUCCESS
Error code: success.
Definition: window_errors.h:27
#define T3_ATTR_REVERSE
Draw characters with reverse video.
Definition: terminal.h:112
void t3_term_hide_cursor(void)
Hide the cursor.
Definition: terminal.c:315
void t3_term_update(void)
Update the terminal, drawing all changes since last refresh.
Definition: terminal.c:644
int t3_term_get_keychar(int msec)
Get a key char from stdin with timeout.
Definition: input.c:253
void t3_win_show(t3_window_t *win)
Make a t3_window_t visible.
Definition: window.c:620
void t3_win_set_paint(t3_window_t *win, int y, int x)
Change the position where characters are written to the t3_window_t.
Definition: window.c:614
int t3_win_addstr(t3_window_t *win, const char *str, t3_attr_t attr)
Add a nul-terminated string to a t3_window_t with specified attributes.
Definition: window_paint.c:880
void t3_win_hide(t3_window_t *win)
Make a t3_window_t invisible.
Definition: window.c:623
int t3_win_box(t3_window_t *win, int y, int x, int height, int width, t3_attr_t attr)
Draw a box on a t3_window_t.
Definition: window_paint.c:1235
t3_window_t * t3_win_new(t3_window_t *parent, int height, int width, int y, int x, int depth)
Create a new t3_window_t.
Definition: window.c:122
An opaque struct representing a window which can be shown on the terminal.
Definition: internal.h:49