1 #include "../include/curses.h"
10 unsigned int _COLOUR_PAIRS = 4;
11 unsigned int _COLOURS = 8;
12 unsigned short _COLS = 80;
13 unsigned short _LINES = 25;
15 static struct termios original, runtime;
17 void _init_screen( struct _curses_screen *scr __unused ) {
18 tcgetattr(fileno(stdin),&original);
19 tcgetattr(fileno(stdin),&runtime);
20 runtime.c_lflag &= ~(ICANON|ECHO);
21 tcsetattr(fileno(stdin),TCSANOW,&runtime);
22 //printf("%c[=%dh",ESC,MODE);
23 LINES = 25; COLS = 80;
26 void _exit_screen( struct _curses_screen *scr __unused ) {
27 printf("%c[1;1H",ESC);
29 tcsetattr(fileno(stdin),TCSANOW,&original);
32 void _movetoyx( struct _curses_screen *scr __unused, unsigned int y, unsigned int x ) {
33 printf( "%c[%d;%dH", ESC, y+1, x+1 );
36 void _putc( struct _curses_screen *scr __unused, chtype c ) {
37 unsigned short pairno;
38 pairno = (unsigned short)(( c & A_COLOUR ) >> CPAIR_SHIFT);
40 // print rendition (colour and attrs)
41 //printf( "%c[%d;%d",ESC,
42 // cpairs[pairno][0], cpairs[pairno][1] );
43 // print rendition (character)
44 //printf("char is \"%d\"", c );
46 fflush(stdout); // There must be a better way to do this...
49 int _getc( struct _curses_screen *scr __unused ) {
57 WE NEED TO PROCESS ANSI SEQUENCES TO PASS BACK KEY_* VALUES
60 while ( scr->peek( scr ) == TRUE ) {
65 if ( strcmp ( buffer, "[D" ) == 0 )
73 bool _peek( struct _curses_screen *scr __unused ) {
75 if ( ( c = getchar() ) != EOF ) {
78 } else { return FALSE; }
84 .movetoyx = _movetoyx,