Changeset 158
- Timestamp:
- Nov 12, 2003, 7:41:02 PM (20 years ago)
- Location:
- ttyvaders/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
ttyvaders/trunk/README
r66 r158 7 7 --enable-slang: use the SLang library (default) 8 8 --enable-ncurses: use the ncurses library 9 --enable-conio: use MS-DOS conio.h 10 11 Cross-compilation example: 12 ./configure --enable-conio --host=i386-pc-msdosdjgpp 9 13 10 14 -
ttyvaders/trunk/configure.ac
r156 r158 15 15 AC_PROG_RANLIB 16 16 17 dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right 18 dnl now otherwise it might be set in an obscure if statement. 19 AC_EGREP_CPP(foo,foo) 20 17 21 AC_ARG_ENABLE(slang, 18 22 [ --enable-slang slang graphics support (default enabled)]) … … 27 31 if test "${enable_conio}" = "yes"; then 28 32 AC_CHECK_HEADER(conio.h,:,AC_MSG_ERROR([cannot find conio.h header])) 33 AC_MSG_CHECKING(for ScreenUpdate in pc.h) 34 AC_EGREP_HEADER(ScreenUpdate,pc.h,[ 35 AC_MSG_RESULT(yes) 36 AC_DEFINE(SCREENUPDATE_IN_PC_H, 1, 37 Define if <pc.h> defines ScreenUpdate.)],[ 38 AC_MSG_RESULT(no)]) 29 39 AC_DEFINE(USE_CONIO, 1, Define if the backend driver is conio.h) 30 40 USE_CONIO=: -
ttyvaders/trunk/libee/ee.c
r156 r158 23 23 #include "config.h" 24 24 25 #if def USE_SLANG25 #if defined(USE_SLANG) 26 26 # include <slang.h> 27 #elif USE_NCURSES27 #elif defined(USE_NCURSES) 28 28 # include <curses.h> 29 #elif USE_CONIO 29 #elif defined(USE_CONIO) 30 # include <dos.h> 30 31 # include <conio.h> 32 # if defined(SCREENUPDATE_IN_PC_H) 33 # include <pc.h> 34 # endif 31 35 #else 32 36 # error "no graphics library detected" … … 42 46 43 47 static int _ee_delay; 44 #if def USE_CONIO48 #if defined(USE_CONIO) 45 49 static struct text_info ti; 50 char *_screen_buffer; 46 51 #endif 47 52 48 53 int ee_init(void) 49 54 { 50 #if def USE_SLANG55 #if defined(USE_SLANG) 51 56 static char * colors[] = { "black", "green", "yellow", "white", 52 57 "red", "gray", "lightgray", "blue", "cyan", "magenta", NULL }; … … 82 87 } 83 88 84 #elif USE_NCURSES89 #elif defined(USE_NCURSES) 85 90 /* Initialize ncurses library */ 86 91 initscr(); … … 105 110 init_pair(EE_MAGENTA, COLOR_MAGENTA, COLOR_BLACK); 106 111 107 #elif USE_CONIO112 #elif defined(USE_CONIO) 108 113 _wscroll = 0; 109 114 _setcursortype(_NOCURSOR); 110 115 clrscr(); 111 116 gettextinfo(&ti); 112 //window(2, 2, 20, 20); 117 _screen_buffer = malloc(ee_get_width() * ee_get_height() * 2); 118 ScreenRetrieve(_screen_buffer); 113 119 114 120 #endif … … 118 124 } 119 125 120 void ee_set_delay(int delay)121 { 122 _ee_delay = delay;126 void ee_set_delay(int usec) 127 { 128 _ee_delay = usec; 123 129 } 124 130 125 131 int ee_get_width(void) 126 132 { 127 #if def USE_SLANG133 #if defined(USE_SLANG) 128 134 return SLtt_Screen_Cols; 129 #elif USE_NCURSES135 #elif defined(USE_NCURSES) 130 136 return COLS; 131 #elif USE_CONIO137 #elif defined(USE_CONIO) 132 138 return ti.screenwidth; 133 139 #endif … … 136 142 int ee_get_height(void) 137 143 { 138 #if def USE_SLANG144 #if defined(USE_SLANG) 139 145 return SLtt_Screen_Rows; 140 #elif USE_NCURSES146 #elif defined(USE_NCURSES) 141 147 return LINES; 142 148 #else … … 145 151 } 146 152 147 #if ndef USE_CONIO153 #if !defined(USE_CONIO) 148 154 static int64_t local_time(void) 149 155 { … … 161 167 void ee_refresh(void) 162 168 { 163 #if ndef USE_CONIO169 #if !defined(USE_CONIO) 164 170 static int64_t local_clock = 0; 165 171 int64_t now; … … 177 183 #endif 178 184 179 #if def USE_SLANG185 #if defined(USE_SLANG) 180 186 SLsmg_refresh(); 181 #elif USE_NCURSES187 #elif defined(USE_NCURSES) 182 188 refresh(); 183 #elif USE_CONIO184 /* Do nothing? */185 #endif 186 187 #if ndef USE_CONIO189 #elif defined(USE_CONIO) 190 ScreenUpdate(_screen_buffer); 191 #endif 192 193 #if !defined(USE_CONIO) 188 194 now = local_time(); 189 195 … … 194 200 195 201 local_clock += _ee_delay; 202 #else 203 delay(5); 196 204 #endif 197 205 } … … 199 207 void ee_end(void) 200 208 { 201 #if def USE_SLANG209 #if defined(USE_SLANG) 202 210 SLtt_set_cursor_visibility(1); 203 211 SLang_reset_tty(); 204 212 SLsmg_reset_smg(); 205 #elif USE_NCURSES213 #elif defined(USE_NCURSES) 206 214 curs_set(1); 207 215 endwin(); 208 #elif USE_CONIO 216 #elif defined(USE_CONIO) 217 ScreenUpdate(_screen_buffer); 209 218 _wscroll = 1; 210 ee_set_color(EE_WHITE); 211 ee_putstr(ee_get_width(), ee_get_height()-1, "\r\n"); 219 textcolor((enum COLORS)WHITE); 220 textbackground((enum COLORS)BLACK); 221 gotoxy(ee_get_width(), ee_get_height()); 222 cputs("\r\n"); 212 223 _setcursortype(_NORMALCURSOR); 213 224 #endif -
ttyvaders/trunk/libee/graphics.c
r156 r158 23 23 #include "config.h" 24 24 25 #if def USE_SLANG25 #if defined(USE_SLANG) 26 26 # include <slang.h> 27 #elif USE_NCURSES27 #elif defined(USE_NCURSES) 28 28 # include <curses.h> 29 #elif USE_CONIO29 #elif defined(USE_CONIO) 30 30 # include <conio.h> 31 31 #else … … 39 39 40 40 static int ee_color = 0; 41 #if def USE_CONIO41 #if defined(USE_CONIO) 42 42 static enum COLORS dos_colors[] = { 43 43 0, … … 58 58 { 59 59 ee_color = color; 60 #if def USE_SLANG60 #if defined(USE_SLANG) 61 61 SLsmg_set_color(color); 62 #elif USE_NCURSES62 #elif defined(USE_NCURSES) 63 63 attrset(COLOR_PAIR(color)); 64 #elif USE_CONIO64 #elif defined(USE_CONIO) 65 65 if(color >= 1 && color <= 10) 66 66 textcolor(dos_colors[color]); … … 73 73 } 74 74 75 extern char *_screen_buffer; 76 75 77 void ee_putchar(int x, int y, char c) 76 78 { 77 #if def USE_SLANG79 #if defined(USE_SLANG) 78 80 SLsmg_gotorc(y,x); 79 81 SLsmg_write_char(c); 80 #elif USE_NCURSES82 #elif defined(USE_NCURSES) 81 83 move(y,x); 82 84 addch(c); 83 #elif USE_CONIO 84 gotoxy(x+1,y+1); 85 putch(c); 85 #elif defined(USE_CONIO) 86 if(x<0 || x>=ee_get_width() || y<0 || y>=ee_get_height()) 87 return; 88 _screen_buffer[2 * (x + y * ee_get_width())] = c; 89 _screen_buffer[2 * (x + y * ee_get_width()) + 1] = dos_colors[ee_color]; 90 // gotoxy(x+1,y+1); 91 // putch(c); 86 92 #endif 87 93 } … … 89 95 void ee_putstr(int x, int y, char *s) 90 96 { 91 #ifdef USE_SLANG 97 if(y<0 || y>=ee_get_height()) 98 return; 99 #if defined(USE_SLANG) 92 100 SLsmg_gotorc(y,x); 93 101 SLsmg_write_string(s); 94 #elif USE_NCURSES102 #elif defined(USE_NCURSES) 95 103 move(y,x); 96 104 addstr(s); 97 #elif USE_CONIO 98 gotoxy(x+1,y+1); 99 cputs(s); 105 #elif defined(USE_CONIO) 106 char *buf = _screen_buffer + 2 * (x + y * ee_get_width()); 107 while(*s) 108 { 109 *buf++ = *s++; 110 *buf++ = dos_colors[ee_color]; 111 } 112 // gotoxy(x+1,y+1); 113 // cputs(s); 100 114 #endif 101 115 }
Note: See TracChangeset
for help on using the changeset viewer.