Changeset 179
- Timestamp:
- Nov 15, 2003, 10:58:20 AM (20 years ago)
- Location:
- libcaca/trunk/libee
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/libee/ee.c
r177 r179 47 47 48 48 /* Global array with color names */ 49 c har *ee_color_names[16] =49 const char *ee_color_names[16] = 50 50 { 51 51 "black", … … 67 67 }; 68 68 69 static int _ee_delay; 69 static unsigned int _ee_delay; 70 static unsigned int _ee_rendertime; 70 71 char *_ee_empty_line; 72 char *_ee_scratch_line; 71 73 72 74 #if defined(USE_NCURSES) … … 186 188 _ee_empty_line[ee_get_width()] = '\0'; 187 189 190 _ee_scratch_line = malloc(ee_get_width() + 1); 191 188 192 _ee_delay = 0; 193 _ee_rendertime = 0; 189 194 190 195 return 0; 191 196 } 192 197 193 int ee_get_width(void)198 unsigned int ee_get_width(void) 194 199 { 195 200 #if defined(USE_SLANG) … … 202 207 } 203 208 204 int ee_get_height(void)209 unsigned int ee_get_height(void) 205 210 { 206 211 #if defined(USE_SLANG) … … 213 218 } 214 219 215 void ee_set_delay( int usec)220 void ee_set_delay(unsigned int usec) 216 221 { 217 222 _ee_delay = usec; 223 } 224 225 unsigned int ee_get_rendertime(void) 226 { 227 return _ee_rendertime; 218 228 } 219 229 … … 240 250 void ee_refresh(void) 241 251 { 242 static int lastticks = 0;252 static unsigned int lastticks = 0; 243 253 unsigned int ticks = lastticks + _ee_getticks(); 244 254 … … 258 268 for(ticks += _ee_getticks(); ticks < _ee_delay; ticks += _ee_getticks()) 259 269 usleep(10000); 270 271 /* Update the sliding mean of the render time */ 272 _ee_rendertime = (7 * _ee_rendertime + ticks) / 8; 260 273 261 274 lastticks = ticks - _ee_delay; -
libcaca/trunk/libee/ee.h
r171 r179 52 52 }; 53 53 54 extern c har *ee_color_names[16];54 extern const char *ee_color_names[16]; 55 55 56 56 /* … … 63 63 */ 64 64 int ee_init(void); 65 void ee_set_delay(int); 66 int ee_get_width(void); 67 int ee_get_height(void); 65 void ee_set_delay(unsigned int); 66 unsigned int ee_get_rendertime(void); 67 unsigned int ee_get_width(void); 68 unsigned int ee_get_height(void); 68 69 void ee_refresh(void); 69 70 void ee_end(void); … … 74 75 int ee_get_color(void); 75 76 void ee_putchar(int, int, char); 76 void ee_putstr(int, int, c har *);77 void ee_putstr(int, int, const char *); 77 78 void ee_clear(void); 78 79 79 80 void ee_draw_line(int, int, int, int, char); 80 void ee_draw_polyline( int[],int[], int, char);81 void ee_draw_polyline(const int[], const int[], int, char); 81 82 void ee_draw_thin_line(int, int, int, int); 82 void ee_draw_thin_polyline( int[],int[], int);83 void ee_draw_thin_polyline(const int[], const int[], int); 83 84 84 85 void ee_draw_circle(int, int, int, char); -
libcaca/trunk/libee/ee_internals.h
r167 r179 33 33 34 34 extern char *_ee_empty_line; 35 extern char *_ee_scratch_line; 35 36 36 37 #endif /* __EE_INTERNALS_H__ */ -
libcaca/trunk/libee/graphics.c
r167 r179 80 80 } 81 81 82 void ee_putstr(int x, int y, c har *s)82 void ee_putstr(int x, int y, const char *s) 83 83 { 84 84 int len; 85 85 86 if(y < 0 || y >= ee_get_height() )86 if(y < 0 || y >= ee_get_height() || x >= ee_get_width()) 87 87 return; 88 88 … … 96 96 s += -x; 97 97 x = 0; 98 } 99 100 if(x + len >= ee_get_width()) 101 { 102 memcpy(_ee_scratch_line, s, ee_get_width() - x); 103 _ee_scratch_line[ee_get_width() - x] = '\0'; 104 s = _ee_scratch_line; 98 105 } 99 106 -
libcaca/trunk/libee/line.c
r165 r179 69 69 } 70 70 71 void ee_draw_polyline( int x[],int y[], int n, char c)71 void ee_draw_polyline(const int x[], const int y[], int n, char c) 72 72 { 73 73 int i; … … 106 106 } 107 107 108 void ee_draw_thin_polyline( int x[],int y[], int n)108 void ee_draw_thin_polyline(const int x[], const int y[], int n) 109 109 { 110 110 int i;
Note: See TracChangeset
for help on using the changeset viewer.