Changeset 158 for ttyvaders/trunk/libee/ee.c
- Timestamp:
- Nov 12, 2003, 7:41:02 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.