libvt100

A library for heling in console programming.
git clone git://r-36.net/libvt100
Log | Files | Refs | README | LICENSE

vt100test.c (915B)


      1 /*
      2  * Copy me if you can.
      3  * by 20h
      4  */
      5 
      6 #include <unistd.h>
      7 #include <time.h>
      8 #include <string.h>
      9 #include <stdlib.h>
     10 
     11 #include "vt100.h"
     12 
     13 int
     14 main(void)
     15 {
     16 	char *str;
     17 	term_t *term;
     18 
     19 	term = term_new();
     20 
     21 	term_fillrectangle(term, 1, 1, term->rows-1, term->cols-1, '.');
     22 
     23 	term_drawrectangle(term, 1, 1, term->rows-1, term->cols-1, '#', '#',
     24 			'#', '#', '#', '#');
     25 	term_drawrectangle(term, 2, 2, 20, 30, '-', '|', '+', '+', '+',
     26 			'+');
     27 	term_fillrectangle(term, 3, 3, 19, 29, ' ');
     28 
     29 	term_printf(3, 3, "Hello here ...");
     30 	term_printf(5, 3, "Another one ...");
     31 	term_error(term, "Something bad happened.");
     32 	term_printf(8, 3, "termrows: %d, termcols: %d", term->rows, term->cols);
     33 	term_printf(10, 3, "sleeping for 1s ...");
     34 
     35 	sleep(1);
     36 
     37 	term_printf(5, 3, "It changed!");
     38 	term_error(term, "Another bad one ...");
     39 	sleep(1);
     40 
     41 	term_error(term, "Oh, another one");
     42 	sleep(2);
     43 
     44 	term_reset(term);
     45 
     46 	return 0;
     47 }
     48