Changeset 524 for libcaca/trunk/examples
- Timestamp:
- Mar 5, 2006, 7:43:13 PM (15 years ago)
- Location:
- libcaca/trunk/examples
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/examples
- Property svn:ignore
-
old new 3 3 .libs 4 4 .deps 5 cacademo6 cacademo.exe7 5 caca-spritedit 8 6 caca-spritedit.exe
-
- Property svn:ignore
-
libcaca/trunk/examples/Makefile.am
r475 r524 5 5 EXTRA_DIST = caca.txt 6 6 7 bin_PROGRAMS = cacademo cacafire cacaball cacaplas cacaview cacamoir 8 9 cacademo_SOURCES = demo.c 10 cacademo_LDADD = ../src/libcaca.la @CACA_LIBS@ @MATH_LIBS@ 11 cacademo_CPPFLAGS = -I$(top_srcdir)/src -DDATADIR=\"$(pkgdatadir)\" 7 bin_PROGRAMS = cacafire cacaball cacaplas cacaview cacamoir 12 8 13 9 cacafire_SOURCES = aafire.c -
libcaca/trunk/examples/aafire.c
r514 r524 38 38 #define MAXTABLE (256*5) 39 39 #ifdef LIBCACA 40 static cucul_t *qq; 41 static caca_t *kk; 40 42 static int XSIZ, YSIZ; 41 static struct c aca_bitmap *caca_bitmap;43 static struct cucul_bitmap *cucul_bitmap; 42 44 static char *bitmap; 43 45 static int pause = 0; … … 97 99 98 100 #ifdef LIBCACA 99 if (caca_init()) 101 qq = cucul_init(); 102 if (!qq) 103 { 104 printf ("Failed to initialize libcucul\n"); 105 exit (1); 106 } 107 kk = caca_attach(qq); 108 if (!kk) 100 109 { 101 110 printf ("Failed to initialize libcaca\n"); 102 111 exit (1); 103 112 } 104 caca_set_delay( 10000);105 XSIZ = c aca_get_width() * 2;106 YSIZ = c aca_get_height() * 2 - 4;113 caca_set_delay(kk, 10000); 114 XSIZ = cucul_get_width(qq) * 2; 115 YSIZ = cucul_get_height(qq) * 2 - 4; 107 116 #else 108 117 context = aa_autoinit (&aa_defparams); … … 130 139 131 140 #ifdef LIBCACA 132 c aca_bitmap = caca_create_bitmap(8, XSIZ, YSIZ - 2, XSIZ, 0, 0, 0, 0);133 c aca_set_bitmap_palette(caca_bitmap, r, g, b, a);134 bitmap = malloc(4 * c aca_get_width() * caca_get_height() * sizeof(char));135 memset(bitmap, 0, 4 * c aca_get_width() * caca_get_height());141 cucul_bitmap = cucul_create_bitmap(qq, 8, XSIZ, YSIZ - 2, XSIZ, 0, 0, 0, 0); 142 cucul_set_bitmap_palette(qq, cucul_bitmap, r, g, b, a); 143 bitmap = malloc(4 * cucul_get_width(qq) * cucul_get_height(qq) * sizeof(char)); 144 memset(bitmap, 0, 4 * cucul_get_width(qq) * cucul_get_height(qq)); 136 145 #else 137 146 aa_hidecursor (context); … … 142 151 { 143 152 #ifdef LIBCACA 144 caca_end(); 153 caca_detach(kk); 154 cucul_end(qq); 145 155 #else 146 156 aa_close (context); … … 224 234 #ifdef LIBCACA 225 235 paused: 226 caca_draw_bitmap(0, 0, caca_get_width() - 1, caca_get_height() - 1, 227 caca_bitmap, bitmap); 228 caca_refresh(); 236 cucul_draw_bitmap(qq, 0, 0, 237 cucul_get_width(qq) - 1, cucul_get_height(qq) - 1, 238 cucul_bitmap, bitmap); 239 caca_refresh(kk); 229 240 /*XSIZ = caca_get_width() * 2; 230 241 YSIZ = caca_get_height() * 2 - 4;*/ … … 249 260 { 250 261 #ifdef LIBCACA 251 switch (caca_get_event( CACA_EVENT_KEY_PRESS))262 switch (caca_get_event(kk, CACA_EVENT_KEY_PRESS)) 252 263 { 253 264 case CACA_EVENT_KEY_PRESS | CACA_KEY_ESCAPE: return; -
libcaca/trunk/examples/cacaball.c
r522 r524 23 23 #endif 24 24 25 #include "cucul.h" 25 26 #include "caca.h" 26 27 … … 43 44 int main(int argc, char **argv) 44 45 { 46 cucul_t *qq; caca_t *kk; 45 47 unsigned int r[256], g[256], b[256], a[256]; 46 48 float d[METABALLS], di[METABALLS], dj[METABALLS], dk[METABALLS]; 47 49 unsigned int x[METABALLS], y[METABALLS]; 48 struct c aca_bitmap *caca_bitmap;50 struct cucul_bitmap *cucul_bitmap; 49 51 float i = 10.0, j = 17.0, k = 11.0; 50 52 int p, frame = 0, pause = 0; 51 53 52 if(caca_init()) 54 qq = cucul_init(); 55 if(!qq) 53 56 return 1; 54 55 caca_set_delay(20000); 57 kk = caca_attach(qq); 58 if(!kk) 59 return 1; 60 61 caca_set_delay(kk, 20000); 56 62 57 63 /* Make the palette eatable by libcaca */ … … 60 66 r[255] = g[255] = b[255] = 0xfff; 61 67 62 /* Create a libc acabitmap smaller than our pixel buffer, so that we68 /* Create a libcucul bitmap smaller than our pixel buffer, so that we 63 69 * display only the interesting part of it */ 64 c aca_bitmap = caca_create_bitmap(8, XSIZ - METASIZE, YSIZ - METASIZE,65 XSIZ, 0, 0, 0, 0);70 cucul_bitmap = cucul_create_bitmap(qq, 8, XSIZ - METASIZE, YSIZ - METASIZE, 71 XSIZ, 0, 0, 0, 0); 66 72 67 73 /* Generate ball sprite */ … … 70 76 for(p = 0; p < METABALLS; p++) 71 77 { 72 d[p] = c aca_rand(0, 100);73 di[p] = (float)c aca_rand(500, 4000) / 6000.0;74 dj[p] = (float)c aca_rand(500, 4000) / 6000.0;75 dk[p] = (float)c aca_rand(500, 4000) / 6000.0;78 d[p] = cucul_rand(0, 100); 79 di[p] = (float)cucul_rand(500, 4000) / 6000.0; 80 dj[p] = (float)cucul_rand(500, 4000) / 6000.0; 81 dk[p] = (float)cucul_rand(500, 4000) / 6000.0; 76 82 } 77 83 … … 79 85 for(;;) 80 86 { 81 switch(caca_get_event( CACA_EVENT_KEY_PRESS))87 switch(caca_get_event(kk, CACA_EVENT_KEY_PRESS)) 82 88 { 83 89 case CACA_EVENT_KEY_PRESS | CACA_KEY_ESCAPE: goto end; … … 110 116 111 117 /* Set the palette */ 112 c aca_set_bitmap_palette(caca_bitmap, r, g, b, a);118 cucul_set_bitmap_palette(qq, cucul_bitmap, r, g, b, a); 113 119 114 120 /* Silly paths for our balls */ … … 135 141 136 142 paused: 137 /* Draw our virtual buffer to screen, letting libcaca resize it */ 138 caca_draw_bitmap(0, 0, caca_get_width() - 1, caca_get_height() - 1, 139 caca_bitmap, pixels + (METASIZE / 2) * (1 + XSIZ)); 140 caca_refresh(); 143 /* Draw our virtual buffer to screen, letting libcucul resize it */ 144 cucul_draw_bitmap(qq, 0, 0, 145 cucul_get_width(qq) - 1, cucul_get_height(qq) - 1, 146 cucul_bitmap, pixels + (METASIZE / 2) * (1 + XSIZ)); 147 caca_refresh(kk); 141 148 } 142 149 143 150 /* End, bye folks */ 144 151 end: 145 caca_free_bitmap(caca_bitmap); 146 caca_end(); 152 cucul_free_bitmap(qq, cucul_bitmap); 153 caca_detach(kk); 154 cucul_end(qq); 147 155 148 156 return 0; -
libcaca/trunk/examples/cacamoir.c
r522 r524 17 17 #include <string.h> 18 18 19 #include "cucul.h" 19 20 #include "caca.h" 20 21 … … 35 36 int main (int argc, char **argv) 36 37 { 38 cucul_t *qq; caca_t *kk; 37 39 unsigned int red[256], green[256], blue[256], alpha[256]; 38 struct c aca_bitmap *bitmap;40 struct cucul_bitmap *bitmap; 39 41 int i, x, y, frame = 0, pause = 0; 40 42 41 if(caca_init() < 0) 43 qq = cucul_init(); 44 if(!qq) 45 return 1; 46 kk = caca_attach(qq); 47 if(!kk) 42 48 return 1; 43 49 44 caca_set_delay( 20000);50 caca_set_delay(kk, 20000); 45 51 46 52 /* Fill various tables */ … … 55 61 draw_disc(i, (i / DISCTHICKNESS) % 2); 56 62 57 /* Create a libc acabitmap */58 bitmap = c aca_create_bitmap(8, XSIZ, YSIZ, XSIZ, 0, 0, 0, 0);63 /* Create a libcucul bitmap */ 64 bitmap = cucul_create_bitmap(qq, 8, XSIZ, YSIZ, XSIZ, 0, 0, 0, 0); 59 65 60 66 /* Main loop */ 61 67 for(;;) 62 68 { 63 switch(caca_get_event( CACA_EVENT_KEY_PRESS))69 switch(caca_get_event(kk, CACA_EVENT_KEY_PRESS)) 64 70 { 65 71 case CACA_EVENT_KEY_PRESS | CACA_KEY_ESCAPE: goto end; … … 81 87 blue[1] = 0.5 * (1 + cos(0.05 * frame + 5.0)) * 0xfff; 82 88 83 c aca_set_bitmap_palette(bitmap, red, green, blue, alpha);89 cucul_set_bitmap_palette(qq, bitmap, red, green, blue, alpha); 84 90 85 91 /* Draw circles */ … … 95 101 96 102 paused: 97 caca_draw_bitmap(0, 0, caca_get_width() - 1, caca_get_height() - 1, 98 bitmap, screen); 99 caca_refresh(); 103 cucul_draw_bitmap(qq, 0, 0, 104 cucul_get_width(qq) - 1, cucul_get_height(qq) - 1, 105 bitmap, screen); 106 caca_refresh(kk); 100 107 } 101 108 102 109 end: 103 caca_free_bitmap(bitmap); 104 caca_end(); 110 cucul_free_bitmap(qq, bitmap); 111 caca_detach(kk); 112 cucul_end(qq); 105 113 106 114 return 0; -
libcaca/trunk/examples/cacaplas.c
r522 r524 21 21 #endif 22 22 23 #include "cucul.h" 23 24 #include "caca.h" 24 25 … … 38 39 int main (int argc, char **argv) 39 40 { 41 cucul_t *qq; caca_t *kk; 40 42 unsigned int red[256], green[256], blue[256], alpha[256]; 41 43 double r[3], R[6]; 42 struct c aca_bitmap *bitmap;44 struct cucul_bitmap *bitmap; 43 45 int i, x, y, frame = 0, pause = 0; 44 46 45 if(caca_init() < 0) 47 qq = cucul_init(); 48 if(!qq) 49 return 1; 50 kk = caca_attach(qq); 51 if(!kk) 46 52 return 1; 47 53 48 caca_set_delay( 20000);54 caca_set_delay(kk, 20000); 49 55 50 56 /* Fill various tables */ … … 53 59 54 60 for(i = 0; i < 3; i++) 55 r[i] = (double)(c aca_rand(1, 1000)) / 60000 * M_PI;61 r[i] = (double)(cucul_rand(1, 1000)) / 60000 * M_PI; 56 62 57 63 for(i = 0; i < 6; i++) 58 R[i] = (double)(c aca_rand(1, 1000)) / 10000;64 R[i] = (double)(cucul_rand(1, 1000)) / 10000; 59 65 60 66 for(y = 0 ; y < TABLEY ; y++) … … 68 74 } 69 75 70 /* Create a libc acabitmap */71 bitmap = c aca_create_bitmap(8, XSIZ, YSIZ, XSIZ, 0, 0, 0, 0);76 /* Create a libcucul bitmap */ 77 bitmap = cucul_create_bitmap(qq, 8, XSIZ, YSIZ, XSIZ, 0, 0, 0, 0); 72 78 73 79 /* Main loop */ 74 80 for(;;) 75 81 { 76 switch(caca_get_event( CACA_EVENT_KEY_PRESS))82 switch(caca_get_event(kk, CACA_EVENT_KEY_PRESS)) 77 83 { 78 84 case CACA_EVENT_KEY_PRESS | CACA_KEY_ESCAPE: goto end; … … 93 99 94 100 /* Set the palette */ 95 c aca_set_bitmap_palette(bitmap, red, green, blue, alpha);101 cucul_set_bitmap_palette(qq, bitmap, red, green, blue, alpha); 96 102 97 103 do_plasma(screen, … … 105 111 106 112 paused: 107 caca_draw_bitmap(0, 0, caca_get_width() - 1, caca_get_height() - 1, 108 bitmap, screen); 109 caca_refresh(); 113 cucul_draw_bitmap(qq, 0, 0, 114 cucul_get_width(qq) - 1, cucul_get_height(qq) - 1, 115 bitmap, screen); 116 caca_refresh(kk); 110 117 } 111 118 112 119 end: 113 caca_free_bitmap(bitmap); 114 caca_end(); 120 cucul_free_bitmap(qq, bitmap); 121 caca_detach(kk); 122 cucul_end(qq); 115 123 116 124 return 0; -
libcaca/trunk/examples/cacaview.c
r522 r524 28 28 #endif 29 29 30 #include "cucul.h" 30 31 #include "caca.h" 31 32 … … 41 42 #define ZOOM_MAX 50 42 43 #define PAD_STEP 0.15 44 45 /* libcucul/libcaca contexts */ 46 cucul_t *qq; caca_t *kk; 43 47 44 48 /* Local functions */ … … 60 64 #endif 61 65 char *pixels = NULL; 62 struct c aca_bitmap *bitmap = NULL;66 struct cucul_bitmap *bitmap = NULL; 63 67 unsigned int w, h, depth, bpp, rmask, gmask, bmask, amask; 64 68 #if !defined(HAVE_IMLIB2_H) … … 79 83 int i; 80 84 81 /* Initialise libcaca */ 82 if(caca_init()) 85 /* Initialise libcucul */ 86 qq = cucul_init(); 87 if(!qq) 88 { 89 fprintf(stderr, "%s: unable to initialise libcucul\n", argv[0]); 90 return 1; 91 } 92 93 kk = caca_attach(qq); 94 if(!kk) 83 95 { 84 96 fprintf(stderr, "%s: unable to initialise libcaca\n", argv[0]); … … 87 99 88 100 /* Set the window title */ 89 caca_set_window_title( "cacaview");90 91 ww = c aca_get_width();92 wh = c aca_get_height();101 caca_set_window_title(kk, "cacaview"); 102 103 ww = cucul_get_width(qq); 104 wh = cucul_get_height(qq); 93 105 94 106 /* Fill the zoom table */ … … 128 140 129 141 if(update) 130 event = caca_get_event( event_mask);142 event = caca_get_event(kk, event_mask); 131 143 else 132 event = caca_wait_event( event_mask);144 event = caca_wait_event(kk, event_mask); 133 145 134 146 while(event) … … 166 178 break; 167 179 case 'b': 168 i = 1 + c aca_get_feature(CACA_BACKGROUND);169 if(i > C ACA_BACKGROUND_MAX) i = CACA_BACKGROUND_MIN;170 c aca_set_feature(i);180 i = 1 + cucul_get_feature(qq, CUCUL_BACKGROUND); 181 if(i > CUCUL_BACKGROUND_MAX) i = CUCUL_BACKGROUND_MIN; 182 cucul_set_feature(qq, i); 171 183 new_status = STATUS_BACKGROUND; 172 184 update = 1; 173 185 break; 174 186 case 'B': 175 i = -1 + c aca_get_feature(CACA_BACKGROUND);176 if(i < C ACA_BACKGROUND_MIN) i = CACA_BACKGROUND_MAX;177 c aca_set_feature(i);187 i = -1 + cucul_get_feature(qq, CUCUL_BACKGROUND); 188 if(i < CUCUL_BACKGROUND_MIN) i = CUCUL_BACKGROUND_MAX; 189 cucul_set_feature(qq, i); 178 190 new_status = STATUS_BACKGROUND; 179 191 update = 1; 180 192 break; 181 193 case 'a': 182 i = 1 + c aca_get_feature(CACA_ANTIALIASING);183 if(i > C ACA_ANTIALIASING_MAX) i = CACA_ANTIALIASING_MIN;184 c aca_set_feature(i);194 i = 1 + cucul_get_feature(qq, CUCUL_ANTIALIASING); 195 if(i > CUCUL_ANTIALIASING_MAX) i = CUCUL_ANTIALIASING_MIN; 196 cucul_set_feature(qq, i); 185 197 new_status = STATUS_ANTIALIASING; 186 198 update = 1; 187 199 break; 188 200 case 'A': 189 i = -1 + c aca_get_feature(CACA_ANTIALIASING);190 if(i < C ACA_ANTIALIASING_MIN) i = CACA_ANTIALIASING_MAX;191 c aca_set_feature(i);201 i = -1 + cucul_get_feature(qq, CUCUL_ANTIALIASING); 202 if(i < CUCUL_ANTIALIASING_MIN) i = CUCUL_ANTIALIASING_MAX; 203 cucul_set_feature(qq, i); 192 204 new_status = STATUS_ANTIALIASING; 193 205 update = 1; 194 206 break; 195 207 case 'd': 196 i = 1 + c aca_get_feature(CACA_DITHERING);197 if(i > C ACA_DITHERING_MAX) i = CACA_DITHERING_MIN;198 c aca_set_feature(i);208 i = 1 + cucul_get_feature(qq, CUCUL_DITHERING); 209 if(i > CUCUL_DITHERING_MAX) i = CUCUL_DITHERING_MIN; 210 cucul_set_feature(qq, i); 199 211 new_status = STATUS_DITHERING; 200 212 update = 1; 201 213 break; 202 214 case 'D': 203 i = -1 + c aca_get_feature(CACA_DITHERING);204 if(i < C ACA_DITHERING_MIN) i = CACA_DITHERING_MAX;205 c aca_set_feature(i);215 i = -1 + cucul_get_feature(qq, CUCUL_DITHERING); 216 if(i < CUCUL_DITHERING_MIN) i = CUCUL_DITHERING_MAX; 217 cucul_set_feature(qq, i); 206 218 new_status = STATUS_DITHERING; 207 219 update = 1; … … 259 271 else if(event == CACA_EVENT_RESIZE) 260 272 { 261 caca_refresh( );262 ww = c aca_get_width();263 wh = c aca_get_height();273 caca_refresh(kk); 274 ww = cucul_get_width(qq); 275 wh = cucul_get_height(qq); 264 276 update = 1; 265 277 set_zoom(zoom); … … 272 284 help = new_help; 273 285 274 event = caca_get_event( CACA_EVENT_KEY_PRESS);286 event = caca_get_event(kk, CACA_EVENT_KEY_PRESS); 275 287 } 276 288 … … 287 299 sprintf(buffer, " Loading `%s'... ", list[current]); 288 300 buffer[ww] = '\0'; 289 c aca_set_color(CACA_COLOR_WHITE, CACA_COLOR_BLUE);290 c aca_putstr((ww - strlen(buffer)) / 2, wh / 2, buffer);291 caca_refresh( );292 ww = c aca_get_width();293 wh = c aca_get_height();301 cucul_set_color(qq, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); 302 cucul_putstr(qq, (ww - strlen(buffer)) / 2, wh / 2, buffer); 303 caca_refresh(kk); 304 ww = cucul_get_width(qq); 305 wh = cucul_get_height(qq); 294 306 295 307 unload_image(); … … 305 317 } 306 318 307 c aca_clear();319 cucul_clear(qq); 308 320 309 321 if(!items) 310 322 { 311 c aca_set_color(CACA_COLOR_WHITE, CACA_COLOR_BLUE);312 c aca_printf(ww / 2 - 5, wh / 2, " No image. ");323 cucul_set_color(qq, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); 324 cucul_printf(qq, ww / 2 - 5, wh / 2, " No image. "); 313 325 } 314 326 else if(!pixels) … … 329 341 sprintf(buffer, ERROR_STRING, list[current]); 330 342 buffer[ww] = '\0'; 331 c aca_set_color(CACA_COLOR_WHITE, CACA_COLOR_BLUE);332 c aca_putstr((ww - strlen(buffer)) / 2, wh / 2, buffer);343 cucul_set_color(qq, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); 344 cucul_putstr(qq, (ww - strlen(buffer)) / 2, wh / 2, buffer); 333 345 free(buffer); 334 346 } … … 349 361 y + height * (1.0 + yfactor) / 2); 350 362 351 c aca_draw_bitmap(ww * (1.0 - xfactor) * xdelta,352 y + height * (1.0 - yfactor) * ydelta,353 ww * (xdelta + (1.0 - xdelta) * xfactor),354 y + height * (ydelta + (1.0 - ydelta) * yfactor),355 bitmap, pixels);363 cucul_draw_bitmap(qq, ww * (1.0 - xfactor) * xdelta, 364 y + height * (1.0 - yfactor) * ydelta, 365 ww * (xdelta + (1.0 - xdelta) * xfactor), 366 y + height * (ydelta + (1.0 - ydelta) * yfactor), 367 bitmap, pixels); 356 368 } 357 369 … … 360 372 print_status(); 361 373 362 c aca_set_color(CACA_COLOR_LIGHTGRAY, CACA_COLOR_BLACK);374 cucul_set_color(qq, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK); 363 375 switch(status) 364 376 { 365 377 case STATUS_ANTIALIASING: 366 c aca_printf(0, wh - 1, "Antialiasing: %s",367 c aca_get_feature_name(caca_get_feature(CACA_ANTIALIASING)));378 cucul_printf(qq, 0, wh - 1, "Antialiasing: %s", 379 cucul_get_feature_name(cucul_get_feature(qq, CUCUL_ANTIALIASING))); 368 380 break; 369 381 case STATUS_DITHERING: 370 c aca_printf(0, wh - 1, "Dithering: %s",371 c aca_get_feature_name(caca_get_feature(CACA_DITHERING)));382 cucul_printf(qq, 0, wh - 1, "Dithering: %s", 383 cucul_get_feature_name(cucul_get_feature(qq, CUCUL_DITHERING))); 372 384 break; 373 385 case STATUS_BACKGROUND: 374 c aca_printf(0, wh - 1, "Background: %s",375 c aca_get_feature_name(caca_get_feature(CACA_BACKGROUND)));386 cucul_printf(qq, 0, wh - 1, "Background: %s", 387 cucul_get_feature_name(cucul_get_feature(qq, CUCUL_BACKGROUND))); 376 388 break; 377 389 } … … 383 395 } 384 396 385 caca_refresh( );397 caca_refresh(kk); 386 398 update = 0; 387 399 } … … 389 401 /* Clean up */ 390 402 unload_image(); 391 caca_end(); 403 caca_detach(kk); 404 cucul_end(qq); 392 405 393 406 return 0; … … 396 409 static void print_status(void) 397 410 { 398 c aca_set_color(CACA_COLOR_WHITE, CACA_COLOR_BLUE);399 c aca_draw_line(0, 0, ww - 1, 0, ' ');400 c aca_draw_line(0, wh - 2, ww - 1, wh - 2, '-');401 c aca_putstr(0, 0, "q:Quit np:Next/Prev +-x:Zoom "402 "hjkl:Move d:Dithering a:Antialias");403 c aca_putstr(ww - strlen("?:Help"), 0, "?:Help");404 c aca_printf(3, wh - 2, "cacaview %s", VERSION);405 c aca_printf(ww - 14, wh - 2, "(zoom: %s%i)", zoom > 0 ? "+" : "", zoom);406 407 c aca_set_color(CACA_COLOR_LIGHTGRAY, CACA_COLOR_BLACK);408 c aca_draw_line(0, wh - 1, ww - 1, wh - 1, ' ');411 cucul_set_color(qq, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); 412 cucul_draw_line(qq, 0, 0, ww - 1, 0, ' '); 413 cucul_draw_line(qq, 0, wh - 2, ww - 1, wh - 2, '-'); 414 cucul_putstr(qq, 0, 0, "q:Quit np:Next/Prev +-x:Zoom " 415 "hjkl:Move d:Dithering a:Antialias"); 416 cucul_putstr(qq, ww - strlen("?:Help"), 0, "?:Help"); 417 cucul_printf(qq, 3, wh - 2, "cacaview %s", VERSION); 418 cucul_printf(qq, ww - 14, wh - 2, "(zoom: %s%i)", zoom > 0 ? "+" : "", zoom); 419 420 cucul_set_color(qq, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK); 421 cucul_draw_line(qq, 0, wh - 1, ww - 1, wh - 1, ' '); 409 422 } 410 423 … … 431 444 int i; 432 445 433 c aca_set_color(CACA_COLOR_WHITE, CACA_COLOR_BLUE);446 cucul_set_color(qq, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); 434 447 435 448 for(i = 0; help[i]; i++) 436 c aca_putstr(x, y + i, help[i]);449 cucul_putstr(qq, x, y + i, help[i]); 437 450 } 438 451 … … 446 459 if(zoom < -ZOOM_MAX) zoom = -ZOOM_MAX; 447 460 448 ww = c aca_get_width();461 ww = cucul_get_width(qq); 449 462 height = fullscreen ? wh : wh - 3; 450 463 451 464 xfactor = (zoom < 0) ? 1.0 / zoomtab[-zoom] : zoomtab[zoom]; 452 465 yfactor = xfactor * ww / height * h / w 453 * c aca_get_height() / caca_get_width()454 * caca_get_window_width( ) / caca_get_window_height();466 * cucul_get_height(qq) / cucul_get_width(qq) 467 * caca_get_window_width(kk) / caca_get_window_height(kk); 455 468 456 469 if(yfactor > xfactor) … … 475 488 #endif 476 489 if(bitmap) 477 c aca_free_bitmap(bitmap);490 cucul_free_bitmap(qq, bitmap); 478 491 bitmap = NULL; 479 492 } … … 499 512 depth = 4; 500 513 501 /* Create the libc acabitmap */502 bitmap = c aca_create_bitmap(bpp, w, h, depth * w,503 rmask, gmask, bmask, amask);514 /* Create the libcucul bitmap */ 515 bitmap = cucul_create_bitmap(qq, bpp, w, h, depth * w, 516 rmask, gmask, bmask, amask); 504 517 if(!bitmap) 505 518 { … … 686 699 int xn, yn; 687 700 688 if(x2 + 1 > (int)c aca_get_width()) x2 = caca_get_width() - 1;689 if(y2 + 1 > (int)c aca_get_height()) y2 = caca_get_height() - 1;701 if(x2 + 1 > (int)cucul_get_width(qq)) x2 = cucul_get_width(qq) - 1; 702 if(y2 + 1 > (int)cucul_get_height(qq)) y2 = cucul_get_height(qq) - 1; 690 703 691 704 for(yn = y1 > 0 ? y1 : 0; yn <= y2; yn++) … … 693 706 { 694 707 if((((xn - x1) / 5) ^ ((yn - y1) / 3)) & 1) 695 c aca_set_color(CACA_COLOR_LIGHTGRAY, CACA_COLOR_DARKGRAY);708 cucul_set_color(qq, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_DARKGRAY); 696 709 else 697 c aca_set_color(CACA_COLOR_DARKGRAY, CACA_COLOR_LIGHTGRAY);698 c aca_putchar(xn, yn, ' ');710 cucul_set_color(qq, CUCUL_COLOR_DARKGRAY, CUCUL_COLOR_LIGHTGRAY); 711 cucul_putchar(qq, xn, yn, ' '); 699 712 } 700 713 }
Note: See TracChangeset
for help on using the changeset viewer.