(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 NAME5 BTUI \- Bruce's Terminal User Interface library6 .SH SYNOPSIS7 .LP8 .nf9 .ft B10 #include <btui.h>11 .ft12 .fi13 .LP14 .nf16 \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 DESCRIPTION42 \fBBTUI\fR is a compact text-user-interface library that can serve as a43 minimalist alternative to ncurses.45 .SH EXAMPLES46 .TP47 .ft48 .fi49 .LP50 .nf51 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 AUTHOR65 Bruce Hill (bruce@bruce-hill.com)