code / btui

Lines2.2K C1.2K Python549 Markdown219 make156 Lua49
(65 lines)
1 .\" Manpage for BTUI.
2 .\" Contact bruce@bruce-hill.com to correct errors or typos.
3 .TH man 1 "16 May 2021" "5" "BTUI manual page"
4 .SH NAME
5 BTUI \- Bruce's Terminal User Interface library
6 .SH SYNOPSIS
7 .LP
8 .nf
9 .ft B
10 #include <btui.h>
11 .ft
12 .fi
13 .LP
14 .nf
16 \fIint \fBbtui_clear(\fIbtui_t *bt, int mode\fB)
17 \fIvoid \fBbtui_disable(\fIbtui_t *bt\fB)
18 \fIvoid \fBbtui_draw_linebox(\fIbtui_t *bt, int x, int y, int w, int h\fB)
19 \fIvoid \fBbtui_draw_shadow(\fIbtui_t *bt, int x, int y, int w, int h\fB)
20 \fIbtui_t* \fBbtui_create(\fIbtui_mode_t mode\fB)
21 \fI#define \fBbtui_enable(\fI) btui_create(BTUI_MODE_TUI\fB)
22 \fIvoid \fBbtui_fill_box(\fIbtui_t *bt, int x, int y, int w, int h\fB)
23 \fIint \fBbtui_flush(\fIbtui_t *bt\fB)
24 \fIint \fBbtui_getkey(\fIbtui_t *bt, int timeout, int *mouse_x, int *mouse_y\fB)
25 \fIint \fBbtui_hide_cursor(\fIbtui_t *bt\fB)
26 \fIchar \fB*btui_keyname(\fIint key, char *buf\fB)
27 \fIint \fBbtui_keynamed(\fIconst char *name\fB)
28 \fIint \fBbtui_move_cursor(\fIbtui_t *bt, int x, int y\fB)
29 \fI#define \fBbtui_printf(\fIbt, ...\fB) fprintf((bt)->out, __VA_ARGS__)
30 \fIint \fBbtui_puts(\fIbtui_t *bt, const char *s\fB)
31 \fIint \fBbtui_scroll(\fIbtui_t *bt, int firstline, int lastline, int scroll_amount\fB)
32 \fIint \fBbtui_set_attributes(\fIbtui_t *bt, attr_t attrs\fB)
33 \fIint \fBbtui_set_bg(\fIbtui_t *bt, unsigned char r, unsigned char g, unsigned char b\fB)
34 \fIint \fBbtui_set_bg_hex(\fIbtui_t *bt, int hex\fB)
35 \fIint \fBbtui_set_cursor(\fIbtui_t *bt, cursor_t cur\fB)
36 \fIint \fBbtui_set_fg(\fIbtui_t *bt, unsigned char r, unsigned char g, unsigned char b\fB)
37 \fIint \fBbtui_set_fg_hex(\fIbtui_t *bt, int hex\fB)
38 \fIint \fBbtui_show_cursor(\fIbtui_t *bt\fB)
39 \fIint \fBbtui_suspend(\fIbtui_t *bt\fB)
41 .SH DESCRIPTION
42 \fBBTUI\fR is a compact text-user-interface library that can serve as a
43 minimalist alternative to ncurses.
45 .SH EXAMPLES
46 .TP
47 .ft
48 .fi
49 .LP
50 .nf
51 btui_t *bt = btui_create(BTUI_MODE_TUI);
52 char name[100];
53 int key = -1;
54 do {
55 btui_clear(bt, BTUI_CLEAR_SCREEN);
56 btui_move_cursor(bt, bt->width/2, bt->height/2);
57 btui_keyname(key, name);
58 btui_printf(bt, "You pressed: %s", name);
59 btui_flush(bt);
60 do key = btui_getkey(bt, 0, NULL, NULL);
61 while (key == -1);
62 } while (key != KEY_CTRL_C && key != 'q');
64 .SH AUTHOR
65 Bruce Hill (bruce@bruce-hill.com)