Changeset 185 for libcaca/trunk/test
- Timestamp:
- Nov 16, 2003, 1:33:35 AM (19 years ago)
- Location:
- libcaca/trunk/test
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/test/Makefile.am
r183 r185 1 1 ############################################################################### 2 # Automake targets and declarations for lib eetests2 # Automake targets and declarations for libcaca tests 3 3 ############################################################################### 4 4 5 AM_CPPFLAGS = -I$(top_srcdir)/lib ee5 AM_CPPFLAGS = -I$(top_srcdir)/libcaca 6 6 7 7 if USE_SLANG … … 15 15 16 16 demo_SOURCES = demo.c 17 demo_LDADD = ../lib ee/libee.a $(LDFLAGS_slang) $(LDFLAGS_ncurses) -lm17 demo_LDADD = ../libcaca/libcaca.a $(LDFLAGS_slang) $(LDFLAGS_ncurses) -lm 18 18 demo_CFLAGS = `pkg-config --cflags gtk+-2.0` 19 19 demo_LDFLAGS = `pkg-config --libs gtk+-2.0` 20 20 21 21 spritedit_SOURCES = spritedit.c 22 spritedit_LDADD = ../lib ee/libee.a $(LDFLAGS_slang) $(LDFLAGS_ncurses) -lm22 spritedit_LDADD = ../libcaca/libcaca.a $(LDFLAGS_slang) $(LDFLAGS_ncurses) -lm 23 23 -
libcaca/trunk/test/demo.c
r183 r185 1 1 /* 2 * demo demo using lib ee2 * demo demo using libcaca 3 3 * Copyright (c) 2003 Sam Hocevar <sam@zoy.org> 4 4 * All Rights Reserved … … 30 30 #include <gdk/gdkpixbuf.h> 31 31 32 #include " ee.h"32 #include "caca.h" 33 33 34 34 static void display_menu(void); … … 47 47 int bounds = 0; 48 48 int outline = 0; 49 struct ee_sprite *sprite = NULL;49 struct caca_sprite *sprite = NULL; 50 50 51 51 GdkPixbuf *pixbuf; … … 58 58 int quit = 0; 59 59 60 if( ee_init())60 if(caca_init()) 61 61 { 62 62 return 1; 63 63 } 64 64 65 ee_set_delay(40000);65 caca_set_delay(40000); 66 66 67 67 /* Initialize data */ 68 sprite = ee_load_sprite("data/barboss.txt");68 sprite = caca_load_sprite("data/barboss.txt"); 69 69 70 70 gdk_init (&argc, &argv); … … 83 83 /* Main menu */ 84 84 display_menu(); 85 ee_refresh();85 caca_refresh(); 86 86 87 87 /* Go ! */ 88 88 while(!quit) 89 89 { 90 char key = ee_get_key();90 char key = caca_get_key(); 91 91 92 92 if(key && demo) 93 93 { 94 94 display_menu(); 95 ee_refresh();95 caca_refresh(); 96 96 demo = NULL; 97 97 } … … 149 149 150 150 if(demo) 151 ee_clear();152 153 key = ee_get_key();151 caca_clear(); 152 153 key = caca_get_key(); 154 154 if(key) 155 155 goto handle_key; 156 156 157 ee_refresh();157 caca_refresh(); 158 158 } 159 159 … … 162 162 demo(); 163 163 164 ee_set_color(EE_WHITE);165 ee_draw_thin_box(1, 1, ee_get_width() - 2, ee_get_height() - 2);166 ee_printf(4, 1, "[%i.%i fps]----",167 1000000 / ee_get_rendertime(),168 (10000000 / ee_get_rendertime()) % 10);169 ee_refresh();164 caca_set_color(EE_WHITE); 165 caca_draw_thin_box(1, 1, caca_get_width() - 2, caca_get_height() - 2); 166 caca_printf(4, 1, "[%i.%i fps]----", 167 1000000 / caca_get_rendertime(), 168 (10000000 / caca_get_rendertime()) % 10); 169 caca_refresh(); 170 170 } 171 171 } 172 172 173 173 /* Clean up */ 174 ee_free_sprite(sprite);175 ee_end();174 caca_free_sprite(sprite); 175 caca_end(); 176 176 177 177 return 0; … … 180 180 static void display_menu(void) 181 181 { 182 int xo = ee_get_width() - 2;183 int yo = ee_get_height() - 2;184 185 ee_clear();186 ee_set_color(EE_WHITE);187 ee_draw_thin_box(1, 1, xo, yo);188 189 ee_putstr((xo - strlen("libee demo")) / 2, 3, "libeedemo");190 ee_putstr((xo - strlen("============")) / 2, 4, "============");191 192 ee_putstr(4, 6, "demos:");193 ee_putstr(4, 7, "'f': full");194 ee_putstr(4, 8, "'1': dots");195 ee_putstr(4, 9, "'2': lines");196 ee_putstr(4, 10, "'3': boxes");197 ee_putstr(4, 11, "'4': triangles");198 ee_putstr(4, 12, "'5': ellipses");199 ee_putstr(4, 13, "'s': sprites");200 ee_putstr(4, 14, "'c': color");201 ee_putstr(4, 15, "'i': image blit");202 203 ee_putstr(4, 17, "settings:");204 ee_printf(4, 18, "'o': outline: %s",182 int xo = caca_get_width() - 2; 183 int yo = caca_get_height() - 2; 184 185 caca_clear(); 186 caca_set_color(EE_WHITE); 187 caca_draw_thin_box(1, 1, xo, yo); 188 189 caca_putstr((xo - strlen("libcaca demo")) / 2, 3, "libcaca demo"); 190 caca_putstr((xo - strlen("==============")) / 2, 4, "=============="); 191 192 caca_putstr(4, 6, "demos:"); 193 caca_putstr(4, 7, "'f': full"); 194 caca_putstr(4, 8, "'1': dots"); 195 caca_putstr(4, 9, "'2': lines"); 196 caca_putstr(4, 10, "'3': boxes"); 197 caca_putstr(4, 11, "'4': triangles"); 198 caca_putstr(4, 12, "'5': ellipses"); 199 caca_putstr(4, 13, "'s': sprites"); 200 caca_putstr(4, 14, "'c': color"); 201 caca_putstr(4, 15, "'i': image blit"); 202 203 caca_putstr(4, 17, "settings:"); 204 caca_printf(4, 18, "'o': outline: %s", 205 205 outline == 0 ? "none" : outline == 1 ? "solid" : "thin"); 206 ee_printf(4, 19, "'b': drawing boundaries: %s",206 caca_printf(4, 19, "'b': drawing boundaries: %s", 207 207 bounds == 0 ? "screen" : "infinite"); 208 208 209 ee_putstr(4, yo - 2, "'q': quit");209 caca_putstr(4, yo - 2, "'q': quit"); 210 210 } 211 211 … … 218 218 i++; 219 219 220 ee_clear();220 caca_clear(); 221 221 222 222 /* Draw the sun */ 223 ee_set_color(EE_YELLOW);224 xo = ee_get_width() / 4;225 yo = ee_get_height() / 4 + 5 * sin(0.03*i);223 caca_set_color(EE_YELLOW); 224 xo = caca_get_width() / 4; 225 yo = caca_get_height() / 4 + 5 * sin(0.03*i); 226 226 227 227 for(j = 0; j < 16; j++) … … 229 229 xa = xo - (30 + sin(0.03*i) * 8) * sin(0.03*i + M_PI*j/8); 230 230 ya = yo + (15 + sin(0.03*i) * 4) * cos(0.03*i + M_PI*j/8); 231 ee_draw_thin_line(xo, yo, xa, ya);231 caca_draw_thin_line(xo, yo, xa, ya); 232 232 } 233 233 234 234 j = 15 + sin(0.03*i) * 8; 235 ee_set_color(EE_WHITE);236 ee_fill_ellipse(xo, yo, j, j / 2, '#');237 ee_set_color(EE_YELLOW);238 ee_draw_ellipse(xo, yo, j, j / 2, '#');235 caca_set_color(EE_WHITE); 236 caca_fill_ellipse(xo, yo, j, j / 2, '#'); 237 caca_set_color(EE_YELLOW); 238 caca_draw_ellipse(xo, yo, j, j / 2, '#'); 239 239 240 240 /* Draw the pyramid */ 241 xo = ee_get_width() * 5 / 8;241 xo = caca_get_width() * 5 / 8; 242 242 yo = 2; 243 243 244 xa = ee_get_width() / 8 + sin(0.03*i) * 5;245 ya = ee_get_height() / 2 + cos(0.03*i) * 5;246 247 xb = ee_get_width() - 10 - cos(0.02*i) * 10;248 yb = ee_get_height() * 3 / 4 - 5 + sin(0.02*i) * 5;249 250 xc = ee_get_width() / 4 - sin(0.02*i) * 5;251 yc = ee_get_height() * 3 / 4 + cos(0.02*i) * 5;252 253 ee_set_color(EE_GREEN);254 ee_fill_triangle(xo, yo, xb, yb, xa, ya, '%');255 ee_set_color(EE_YELLOW);256 ee_draw_thin_triangle(xo, yo, xb, yb, xa, ya);257 258 ee_set_color(EE_RED);259 ee_fill_triangle(xa, ya, xb, yb, xc, yc, '#');260 ee_set_color(EE_YELLOW);261 ee_draw_thin_triangle(xa, ya, xb, yb, xc, yc);262 263 ee_set_color(EE_BLUE);264 ee_fill_triangle(xo, yo, xb, yb, xc, yc, '%');265 ee_set_color(EE_YELLOW);266 ee_draw_thin_triangle(xo, yo, xb, yb, xc, yc);244 xa = caca_get_width() / 8 + sin(0.03*i) * 5; 245 ya = caca_get_height() / 2 + cos(0.03*i) * 5; 246 247 xb = caca_get_width() - 10 - cos(0.02*i) * 10; 248 yb = caca_get_height() * 3 / 4 - 5 + sin(0.02*i) * 5; 249 250 xc = caca_get_width() / 4 - sin(0.02*i) * 5; 251 yc = caca_get_height() * 3 / 4 + cos(0.02*i) * 5; 252 253 caca_set_color(EE_GREEN); 254 caca_fill_triangle(xo, yo, xb, yb, xa, ya, '%'); 255 caca_set_color(EE_YELLOW); 256 caca_draw_thin_triangle(xo, yo, xb, yb, xa, ya); 257 258 caca_set_color(EE_RED); 259 caca_fill_triangle(xa, ya, xb, yb, xc, yc, '#'); 260 caca_set_color(EE_YELLOW); 261 caca_draw_thin_triangle(xa, ya, xb, yb, xc, yc); 262 263 caca_set_color(EE_BLUE); 264 caca_fill_triangle(xo, yo, xb, yb, xc, yc, '%'); 265 caca_set_color(EE_YELLOW); 266 caca_draw_thin_triangle(xo, yo, xb, yb, xc, yc); 267 267 268 268 /* Draw a background triangle */ … … 270 270 ya = 2; 271 271 272 xb = ee_get_width() - 3;273 yb = ee_get_height() / 2;274 275 xc = ee_get_width() / 3;276 yc = ee_get_height() - 3;277 278 ee_set_color(EE_CYAN);279 ee_draw_thin_triangle(xa, ya, xb, yb, xc, yc);280 281 xo = ee_get_width() / 2 + cos(0.027*i) * ee_get_width() / 3;282 yo = ee_get_height() / 2 - sin(0.027*i) * ee_get_height() / 2;283 284 ee_draw_thin_line(xa, ya, xo, yo);285 ee_draw_thin_line(xb, yb, xo, yo);286 ee_draw_thin_line(xc, yc, xo, yo);272 xb = caca_get_width() - 3; 273 yb = caca_get_height() / 2; 274 275 xc = caca_get_width() / 3; 276 yc = caca_get_height() - 3; 277 278 caca_set_color(EE_CYAN); 279 caca_draw_thin_triangle(xa, ya, xb, yb, xc, yc); 280 281 xo = caca_get_width() / 2 + cos(0.027*i) * caca_get_width() / 3; 282 yo = caca_get_height() / 2 - sin(0.027*i) * caca_get_height() / 2; 283 284 caca_draw_thin_line(xa, ya, xo, yo); 285 caca_draw_thin_line(xb, yb, xo, yo); 286 caca_draw_thin_line(xc, yc, xo, yo); 287 287 288 288 /* Draw a sprite on the pyramid */ 289 ee_draw_sprite(xo, yo, sprite, 0);289 caca_draw_sprite(xo, yo, sprite, 0); 290 290 291 291 /* Draw a trail behind the foreground sprite */ 292 292 for(j = i - 60; j < i; j++) 293 293 { 294 int delta = ee_rand(-5, 5);295 ee_set_color(ee_rand(0, 15));296 ee_putchar(ee_get_width() / 2297 + cos(0.02*j) * (delta + ee_get_width() / 4),298 ee_get_height() / 2299 + sin(0.02*j) * (delta + ee_get_height() / 3),294 int delta = caca_rand(-5, 5); 295 caca_set_color(caca_rand(0, 15)); 296 caca_putchar(caca_get_width() / 2 297 + cos(0.02*j) * (delta + caca_get_width() / 4), 298 caca_get_height() / 2 299 + sin(0.02*j) * (delta + caca_get_height() / 3), 300 300 '#'); 301 301 } 302 302 303 303 /* Draw foreground sprite */ 304 ee_draw_sprite(ee_get_width() / 2 + cos(0.02*i) * ee_get_width() / 4,305 ee_get_height() / 2 + sin(0.02*i) * ee_get_height() / 3,304 caca_draw_sprite(caca_get_width() / 2 + cos(0.02*i) * caca_get_width() / 4, 305 caca_get_height() / 2 + sin(0.02*i) * caca_get_height() / 3, 306 306 sprite, 0); 307 307 } … … 309 309 static void demo_dots(void) 310 310 { 311 int xmax = ee_get_width() - 1;312 int ymax = ee_get_height() - 1;311 int xmax = caca_get_width() - 1; 312 int ymax = caca_get_height() - 1; 313 313 int i; 314 314 … … 316 316 { 317 317 /* Putpixel */ 318 ee_set_color(ee_rand(0, 15));319 ee_putchar(ee_rand(0, xmax), ee_rand(0, ymax), '#');318 caca_set_color(caca_rand(0, 15)); 319 caca_putchar(caca_rand(0, xmax), caca_rand(0, ymax), '#'); 320 320 } 321 321 } … … 326 326 char buf[BUFSIZ]; 327 327 328 ee_clear();328 caca_clear(); 329 329 for(i = 0; i < 16; i++) 330 330 { 331 sprintf(buf, "'%c': %i (%s)", 'a' + i, i, ee_get_color_name(i));332 ee_set_color(EE_WHITE);333 ee_putstr(4, i + 3, buf);334 ee_set_color(i);335 ee_putstr(40, i + 3, "XXXXXXXXXX-XX--X----------");331 sprintf(buf, "'%c': %i (%s)", 'a' + i, i, caca_get_color_name(i)); 332 caca_set_color(EE_WHITE); 333 caca_putstr(4, i + 3, buf); 334 caca_set_color(i); 335 caca_putstr(40, i + 3, "XXXXXXXXXX-XX--X----------"); 336 336 } 337 337 } … … 339 339 static void demo_lines(void) 340 340 { 341 int w = ee_get_width();342 int h = ee_get_height();341 int w = caca_get_width(); 342 int h = caca_get_height(); 343 343 int xa, ya, xb, yb; 344 344 345 345 if(bounds) 346 346 { 347 xa = ee_rand(- w, 2 * w); ya = ee_rand(- h, 2 * h);348 xb = ee_rand(- w, 2 * w); yb = ee_rand(- h, 2 * h);347 xa = caca_rand(- w, 2 * w); ya = caca_rand(- h, 2 * h); 348 xb = caca_rand(- w, 2 * w); yb = caca_rand(- h, 2 * h); 349 349 } 350 350 else 351 351 { 352 xa = ee_rand(0, w - 1); ya = ee_rand(0, h - 1);353 xb = ee_rand(0, w - 1); yb = ee_rand(0, h - 1);354 } 355 356 ee_set_color(ee_rand(0, 15));352 xa = caca_rand(0, w - 1); ya = caca_rand(0, h - 1); 353 xb = caca_rand(0, w - 1); yb = caca_rand(0, h - 1); 354 } 355 356 caca_set_color(caca_rand(0, 15)); 357 357 if(outline > 1) 358 ee_draw_thin_line(xa, ya, xb, yb);358 caca_draw_thin_line(xa, ya, xb, yb); 359 359 else 360 ee_draw_line(xa, ya, xb, yb, '#');360 caca_draw_line(xa, ya, xb, yb, '#'); 361 361 } 362 362 363 363 static void demo_boxes(void) 364 364 { 365 int w = ee_get_width();366 int h = ee_get_height();365 int w = caca_get_width(); 366 int h = caca_get_height(); 367 367 int xa, ya, xb, yb; 368 368 369 369 if(bounds) 370 370 { 371 xa = ee_rand(- w, 2 * w); ya = ee_rand(- h, 2 * h);372 xb = ee_rand(- w, 2 * w); yb = ee_rand(- h, 2 * h);371 xa = caca_rand(- w, 2 * w); ya = caca_rand(- h, 2 * h); 372 xb = caca_rand(- w, 2 * w); yb = caca_rand(- h, 2 * h); 373 373 } 374 374 else 375 375 { 376 xa = ee_rand(0, w - 1); ya = ee_rand(0, h - 1);377 xb = ee_rand(0, w - 1); yb = ee_rand(0, h - 1);378 } 379 380 ee_set_color(ee_rand(0, 15));381 ee_fill_box(xa, ya, xb, yb, '#');382 383 ee_set_color(ee_rand(0, 15));376 xa = caca_rand(0, w - 1); ya = caca_rand(0, h - 1); 377 xb = caca_rand(0, w - 1); yb = caca_rand(0, h - 1); 378 } 379 380 caca_set_color(caca_rand(0, 15)); 381 caca_fill_box(xa, ya, xb, yb, '#'); 382 383 caca_set_color(caca_rand(0, 15)); 384 384 if(outline == 2) 385 ee_draw_thin_box(xa, ya, xb, yb);385 caca_draw_thin_box(xa, ya, xb, yb); 386 386 else if(outline == 1) 387 ee_draw_box(xa, ya, xb, yb, '#');387 caca_draw_box(xa, ya, xb, yb, '#'); 388 388 } 389 389 390 390 static void demo_ellipses(void) 391 391 { 392 int w = ee_get_width();393 int h = ee_get_height();392 int w = caca_get_width(); 393 int h = caca_get_height(); 394 394 int x, y, a, b; 395 395 396 396 if(bounds) 397 397 { 398 x = ee_rand(- w, 2 * w); y = ee_rand(- h, 2 * h);399 a = ee_rand(0, w); b = ee_rand(0, h);398 x = caca_rand(- w, 2 * w); y = caca_rand(- h, 2 * h); 399 a = caca_rand(0, w); b = caca_rand(0, h); 400 400 } 401 401 else … … 403 403 do 404 404 { 405 x = ee_rand(0, w); y = ee_rand(0, h);406 a = ee_rand(0, w); b = ee_rand(0, h);405 x = caca_rand(0, w); y = caca_rand(0, h); 406 a = caca_rand(0, w); b = caca_rand(0, h); 407 407 408 408 } while(x - a < 0 || x + a >= w || y - b < 0 || y + b >= h); 409 409 } 410 410 411 ee_set_color(ee_rand(0, 15));412 ee_fill_ellipse(x, y, a, b, '#');413 414 ee_set_color(ee_rand(0, 15));411 caca_set_color(caca_rand(0, 15)); 412 caca_fill_ellipse(x, y, a, b, '#'); 413 414 caca_set_color(caca_rand(0, 15)); 415 415 if(outline == 2) 416 ee_draw_thin_ellipse(x, y, a, b);416 caca_draw_thin_ellipse(x, y, a, b); 417 417 else if(outline == 1) 418 ee_draw_ellipse(x, y, a, b, '#');418 caca_draw_ellipse(x, y, a, b, '#'); 419 419 } 420 420 421 421 static void demo_triangles(void) 422 422 { 423 int w = ee_get_width();424 int h = ee_get_height();423 int w = caca_get_width(); 424 int h = caca_get_height(); 425 425 int xa, ya, xb, yb, xc, yc; 426 426 427 427 if(bounds) 428 428 { 429 xa = ee_rand(- w, 2 * w); ya = ee_rand(- h, 2 * h);430 xb = ee_rand(- w, 2 * w); yb = ee_rand(- h, 2 * h);431 xc = ee_rand(- w, 2 * w); yc = ee_rand(- h, 2 * h);429 xa = caca_rand(- w, 2 * w); ya = caca_rand(- h, 2 * h); 430 xb = caca_rand(- w, 2 * w); yb = caca_rand(- h, 2 * h); 431 xc = caca_rand(- w, 2 * w); yc = caca_rand(- h, 2 * h); 432 432 } 433 433 else 434 434 { 435 435 436 xa = ee_rand(0, w - 1); ya = ee_rand(0, h - 1);437 xb = ee_rand(0, w - 1); yb = ee_rand(0, h - 1);438 xc = ee_rand(0, w - 1); yc = ee_rand(0, h - 1);439 } 440 441 ee_set_color(ee_rand(0, 15));442 ee_fill_triangle(xa, ya, xb, yb, xc, yc, '#');443 444 ee_set_color(ee_rand(0, 15));436 xa = caca_rand(0, w - 1); ya = caca_rand(0, h - 1); 437 xb = caca_rand(0, w - 1); yb = caca_rand(0, h - 1); 438 xc = caca_rand(0, w - 1); yc = caca_rand(0, h - 1); 439 } 440 441 caca_set_color(caca_rand(0, 15)); 442 caca_fill_triangle(xa, ya, xb, yb, xc, yc, '#'); 443 444 caca_set_color(caca_rand(0, 15)); 445 445 if(outline == 2) 446 ee_draw_thin_triangle(xa, ya, xb, yb, xc, yc);446 caca_draw_thin_triangle(xa, ya, xb, yb, xc, yc); 447 447 else if(outline == 1) 448 ee_draw_triangle(xa, ya, xb, yb, xc, yc, '#');448 caca_draw_triangle(xa, ya, xb, yb, xc, yc, '#'); 449 449 } 450 450 451 451 static void demo_sprites(void) 452 452 { 453 ee_draw_sprite(ee_rand(0, ee_get_width() - 1),454 ee_rand(0, ee_get_height() - 1), sprite, 0);453 caca_draw_sprite(caca_rand(0, caca_get_width() - 1), 454 caca_rand(0, caca_get_height() - 1), sprite, 0); 455 455 } 456 456 457 457 static void demo_blit(void) 458 458 { 459 ee_set_color(EE_LIGHTGRAY);460 ee_blit(6, 4, ee_get_width() - 6, ee_get_height() - 4, pixels, bufx, bufy);461 } 462 459 caca_set_color(EE_LIGHTGRAY); 460 caca_blit(6, 4, caca_get_width() - 6, caca_get_height() - 4, pixels, bufx, bufy); 461 } 462 -
libcaca/trunk/test/spritedit.c
r153 r185 1 1 /* 2 * spritedit sprite editor using lib ee2 * spritedit sprite editor using libcaca 3 3 * Copyright (c) 2003 Sam Hocevar <sam@zoy.org> 4 4 * All Rights Reserved … … 25 25 #include <stdio.h> 26 26 27 #include " ee.h"27 #include "caca.h" 28 28 29 29 int main(int argc, char **argv) 30 30 { 31 31 int quit = 0; 32 struct ee_sprite *sprite;32 struct caca_sprite *sprite; 33 33 int frame = 0; 34 34 … … 39 39 } 40 40 41 if( ee_init())41 if(caca_init()) 42 42 return 1; 43 43 44 sprite = ee_load_sprite(argv[1]);44 sprite = caca_load_sprite(argv[1]); 45 45 46 46 if(!sprite) 47 47 { 48 ee_end();48 caca_end(); 49 49 fprintf(stderr, "%s: could not open `%s'.\n", argv[0], argv[1]); 50 50 return 1; … … 57 57 char buf[BUFSIZ]; 58 58 59 switch( ee_get_key())59 switch(caca_get_key()) 60 60 { 61 61 case 0: … … 69 69 break; 70 70 case '+': 71 if(frame < ee_get_sprite_frames(sprite) - 1)71 if(frame < caca_get_sprite_frames(sprite) - 1) 72 72 frame++; 73 73 break; 74 74 } 75 75 76 ee_clear();76 caca_clear(); 77 77 78 ee_set_color(EE_WHITE);79 ee_draw_thin_box(0, 0, ee_get_width() - 1, ee_get_height() - 1);78 caca_set_color(EE_WHITE); 79 caca_draw_thin_box(0, 0, caca_get_width() - 1, caca_get_height() - 1); 80 80 81 ee_putstr(3, 0, "[ Sprite editor for libee]");81 caca_putstr(3, 0, "[ Sprite editor for libcaca ]"); 82 82 83 83 sprintf(buf, "sprite `%s'", argv[1]); 84 ee_putstr(3, 2, buf);85 sprintf(buf, "frame %i/%i", frame, ee_get_sprite_frames(sprite) - 1);86 ee_putstr(3, 3, buf);84 caca_putstr(3, 2, buf); 85 sprintf(buf, "frame %i/%i", frame, caca_get_sprite_frames(sprite) - 1); 86 caca_putstr(3, 3, buf); 87 87 88 88 /* Crosshair */ 89 ee_draw_thin_line(57, 2, 57, 18);90 ee_draw_thin_line(37, 10, 77, 10);91 ee_putchar(57, 10, '+');89 caca_draw_thin_line(57, 2, 57, 18); 90 caca_draw_thin_line(37, 10, 77, 10); 91 caca_putchar(57, 10, '+'); 92 92 93 93 /* Boxed sprite */ 94 xa = -1 - ee_get_sprite_dx(sprite, frame);95 ya = -1 - ee_get_sprite_dy(sprite, frame);96 xb = xa + 1 + ee_get_sprite_width(sprite, frame);97 yb = ya + 1 + ee_get_sprite_height(sprite, frame);98 ee_set_color(EE_BLACK);99 ee_fill_box(57 + xa, 10 + ya, 57 + xb, 10 + yb, ' ');100 ee_set_color(EE_WHITE);101 ee_draw_thin_box(57 + xa, 10 + ya, 57 + xb, 10 + yb);102 ee_draw_sprite(57, 10, sprite, frame);94 xa = -1 - caca_get_sprite_dx(sprite, frame); 95 ya = -1 - caca_get_sprite_dy(sprite, frame); 96 xb = xa + 1 + caca_get_sprite_width(sprite, frame); 97 yb = ya + 1 + caca_get_sprite_height(sprite, frame); 98 caca_set_color(EE_BLACK); 99 caca_fill_box(57 + xa, 10 + ya, 57 + xb, 10 + yb, ' '); 100 caca_set_color(EE_WHITE); 101 caca_draw_thin_box(57 + xa, 10 + ya, 57 + xb, 10 + yb); 102 caca_draw_sprite(57, 10, sprite, frame); 103 103 104 104 /* Free sprite */ 105 ee_draw_sprite(20, 10, sprite, frame);105 caca_draw_sprite(20, 10, sprite, frame); 106 106 107 ee_refresh();107 caca_refresh(); 108 108 } 109 109 110 110 /* Clean up */ 111 ee_end();111 caca_end(); 112 112 113 113 return 0;
Note: See TracChangeset
for help on using the changeset viewer.