- Timestamp:
- Feb 17, 2004, 2:53:14 PM (19 years ago)
- Location:
- ttyvaders/trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
ttyvaders/trunk/configure.ac
r191 r365 13 13 AM_PROG_CC_C_O 14 14 AC_PROG_CPP 15 AC_PROG_RANLIB16 15 17 16 dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right … … 19 18 AC_EGREP_CPP(foo,foo) 20 19 21 AC_ARG_ENABLE(slang, 22 [ --enable-slang slang graphics support (default enabled)]) 23 AC_ARG_ENABLE(ncurses, 24 [ --enable-ncurses ncurses graphics support (default disabled)]) 25 AC_ARG_ENABLE(conio, 26 [ --enable-conio DOS conio.h graphics support (default disabled)]) 27 28 USE_SLANG=false 29 USE_NCURSES=false 30 USE_CONIO=false 31 if test "${enable_conio}" = "yes"; then 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)]) 39 AC_DEFINE(USE_CONIO, 1, Define if the backend driver is conio.h) 40 USE_CONIO=: 41 elif test "${enable_ncurses}" = "yes"; then 42 AC_CHECK_HEADER(ncurses.h,:,AC_MSG_ERROR([cannot find ncurses headers])) 43 AC_CHECK_LIB(ncurses,initscr,:,AC_MSG_ERROR([cannot find ncurses library])) 44 AC_DEFINE(USE_NCURSES, 1, Define if the backend driver is ncurses) 45 USE_NCURSES=: 46 elif test "${enable_slang}" != "no"; then 47 AC_CHECK_HEADER(slang.h,:,AC_MSG_ERROR([cannot find slang headers])) 48 AC_CHECK_LIB(slang,SLkp_init,:,AC_MSG_ERROR([cannot find slang library])) 49 AC_DEFINE(USE_SLANG, 1, Define if the backend driver is slang) 50 USE_SLANG=: 20 AC_MSG_CHECKING(for libcaca support) 21 video_caca=no 22 AC_TRY_COMPILE([ 23 #include <caca.h> 24 ],[ ],[video_caca=yes]) 25 AC_MSG_RESULT($video_caca) 26 if test "$video_caca" = "yes"; then 27 CACA_CFLAGS="${CFLAGS} `caca-config --cflags`" 28 CACA_LIBS="${LIBS} `caca-config --libs`" 29 AC_SUBST(CACA_CFLAGS) 30 AC_SUBST(CACA_LIBS) 31 else 32 AC_MSG_ERROR([cannot find libcaca]) 51 33 fi 52 53 AM_CONDITIONAL(USE_SLANG, ${USE_SLANG})54 AM_CONDITIONAL(USE_NCURSES, ${USE_NCURSES})55 34 56 35 # Optimizations -
ttyvaders/trunk/src/Makefile.am
r191 r365 2 2 # Automake targets and declarations for ttyvaders 3 3 ############################################################################### 4 5 AM_CPPFLAGS = -I$(top_srcdir)/../libcaca/src6 7 if USE_SLANG8 LDFLAGS_slang = -lslang9 endif10 if USE_NCURSES11 LDFLAGS_ncurses = -lncurses12 endif13 4 14 5 bin_PROGRAMS = ttyvaders … … 30 21 weapons.c \ 31 22 $(NULL) 32 ttyvaders_LDADD = ../../libcaca/src/libcaca.a $(LDFLAGS_slang) $(LDFLAGS_ncurses) -lm 23 ttyvaders_CFLAGS = @CACA_CFLAGS@ 24 ttyvaders_LDADD = @CACA_LIBS@ -lm 33 25 -
ttyvaders/trunk/src/box.c
r194 r365 46 46 int j, frame; 47 47 48 caca_set_color(CACA_COLOR_YELLOW );48 caca_set_color(CACA_COLOR_YELLOW, CACA_COLOR_BLACK); 49 49 50 50 /* Draw the thin horizontal line */ … … 69 69 b->x + b->w / 2 - 1, b->y + b->h * (frame - 8) / 8 - 1, 'X'); 70 70 71 caca_set_color(CACA_COLOR_BLACK );71 caca_set_color(CACA_COLOR_BLACK, CACA_COLOR_BLACK); 72 72 73 73 for(j = b->y - b->h * (frame - 8) / 8 + 1; … … 85 85 86 86 /* Draw the text inside the frame */ 87 caca_set_color(CACA_COLOR_YELLOW );87 caca_set_color(CACA_COLOR_YELLOW, CACA_COLOR_BLACK); 88 88 89 89 /* FIXME: use a font */ -
ttyvaders/trunk/src/ceo.c
r186 r365 36 36 caca_clear(); 37 37 38 if(caca_get_key() == '\t') 38 if(caca_get_event(CACA_EVENT_KEY_PRESS) 39 == (CACA_EVENT_KEY_PRESS | '\t')) 39 40 { 40 41 end = 1; -
ttyvaders/trunk/src/intro.c
r194 r365 37 37 int frame = 0; 38 38 39 while(caca_get_ key() == 0)39 while(caca_get_event(CACA_EVENT_KEY_PRESS) == 0) 40 40 { 41 41 int i, xo, yo, x[5], y[5]; … … 48 48 yo = caca_get_height() / 2; 49 49 50 caca_set_color(CACA_COLOR_RED );50 caca_set_color(CACA_COLOR_RED, CACA_COLOR_BLACK); 51 51 caca_fill_ellipse(xo, yo, 16, 8, '#'); 52 caca_set_color(CACA_COLOR_GREEN );52 caca_set_color(CACA_COLOR_GREEN, CACA_COLOR_BLACK); 53 53 caca_draw_thin_ellipse(xo, yo, 16, 8); 54 54 … … 61 61 y[4] = y[0]; 62 62 63 caca_set_color(CACA_COLOR_BLACK );63 caca_set_color(CACA_COLOR_BLACK, CACA_COLOR_BLACK); 64 64 caca_fill_triangle(x[0], y[0], x[1], y[1], x[2], y[2], ' '); 65 65 caca_fill_triangle(x[0], y[0], x[3], y[3], x[2], y[2], ' '); 66 66 caca_draw_line(x[0], y[0], x[2], y[2], ' '); 67 caca_set_color(CACA_COLOR_GREEN );67 caca_set_color(CACA_COLOR_GREEN, CACA_COLOR_BLACK); 68 68 caca_draw_thin_polyline(x, y, 4); 69 69 -
ttyvaders/trunk/src/main.c
r194 r365 99 99 while(!quit) 100 100 { 101 charkey;102 103 while(( key = caca_get_key()))101 int event, key; 102 103 while((event = caca_get_event(CACA_EVENT_KEY_PRESS))) 104 104 { 105 key = event & 0xffffff; 106 105 107 switch(key) 106 108 { -
ttyvaders/trunk/src/overlay.c
r194 r365 33 33 34 34 /* Draw life jauge */ 35 caca_set_color(CACA_COLOR_DARKGRAY );35 caca_set_color(CACA_COLOR_DARKGRAY, CACA_COLOR_BLACK); 36 36 caca_putstr(4, 1, dots30); 37 37 38 38 if(g->p->life > MAX_LIFE * 7 / 10) 39 39 { 40 caca_set_color(CACA_COLOR_GREEN );40 caca_set_color(CACA_COLOR_GREEN, CACA_COLOR_BLACK); 41 41 } 42 42 else if(g->p->life > MAX_LIFE * 3 / 10) 43 43 { 44 caca_set_color(CACA_COLOR_YELLOW );44 caca_set_color(CACA_COLOR_YELLOW, CACA_COLOR_BLACK); 45 45 } 46 46 else 47 47 { 48 caca_set_color(CACA_COLOR_RED );48 caca_set_color(CACA_COLOR_RED, CACA_COLOR_BLACK); 49 49 } 50 50 51 51 caca_putstr(4, 1, dashes30 + (MAX_LIFE - g->p->life) * 30 / MAX_LIFE); 52 52 53 caca_set_color(CACA_COLOR_WHITE );53 caca_set_color(CACA_COLOR_WHITE, CACA_COLOR_BLACK); 54 54 caca_putstr(1, 1, "L |"); 55 55 caca_putstr(34, 1, "|"); 56 56 57 57 /* Draw weapon jauge */ 58 caca_set_color(CACA_COLOR_DARKGRAY );58 caca_set_color(CACA_COLOR_DARKGRAY, CACA_COLOR_BLACK); 59 59 caca_putstr(42, 1, dots30 + 10); 60 60 61 61 if(g->p->special > MAX_SPECIAL * 9 / 10) 62 62 { 63 caca_set_color(CACA_COLOR_WHITE );63 caca_set_color(CACA_COLOR_WHITE, CACA_COLOR_BLACK); 64 64 } 65 65 else if(g->p->special > MAX_SPECIAL * 3 / 10) 66 66 { 67 caca_set_color(CACA_COLOR_CYAN );67 caca_set_color(CACA_COLOR_CYAN, CACA_COLOR_BLACK); 68 68 } 69 69 else 70 70 { 71 caca_set_color(CACA_COLOR_BLUE );71 caca_set_color(CACA_COLOR_BLUE, CACA_COLOR_BLACK); 72 72 } 73 73 … … 75 75 + (MAX_SPECIAL - g->p->special) * 20 / MAX_SPECIAL); 76 76 77 caca_set_color(CACA_COLOR_WHITE );77 caca_set_color(CACA_COLOR_WHITE, CACA_COLOR_BLACK); 78 78 caca_putstr(39, 1, "S |"); 79 79 caca_putstr(62, 1, "|"); -
ttyvaders/trunk/src/starfield.c
r194 r365 56 56 if(s[i].x >= 0) 57 57 { 58 caca_set_color(s[i].c );58 caca_set_color(s[i].c, CACA_COLOR_BLACK); 59 59 caca_putchar(s[i].x, s[i].y, s[i].ch); 60 60 } -
ttyvaders/trunk/src/tunnel.c
r194 r365 78 78 char c; 79 79 80 caca_set_color(CACA_COLOR_ GREEN);80 caca_set_color(CACA_COLOR_RED, CACA_COLOR_BLACK); 81 81 82 82 /* Left border */ … … 116 116 } 117 117 118 caca_set_color(CACA_COLOR_ RED);118 caca_set_color(CACA_COLOR_LIGHTRED, CACA_COLOR_RED); 119 119 120 120 /* Left concrete */ -
ttyvaders/trunk/src/weapons.c
r194 r365 57 57 { 58 58 case WEAPON_LASER: 59 caca_set_color(CACA_COLOR_WHITE );59 caca_set_color(CACA_COLOR_WHITE, CACA_COLOR_BLACK); 60 60 caca_putchar(wp->x[i] >> 4, wp->y[i] >> 4, '|'); 61 caca_set_color(CACA_COLOR_CYAN );61 caca_set_color(CACA_COLOR_CYAN, CACA_COLOR_BLACK); 62 62 caca_putchar(wp->x[i] >> 4, (wp->y[i] >> 4) + 1, '|'); 63 63 break; 64 64 case WEAPON_SEEKER: 65 caca_set_color(CACA_COLOR_CYAN );65 caca_set_color(CACA_COLOR_CYAN, CACA_COLOR_BLACK); 66 66 caca_putchar(wp->x3[i] >> 4, wp->y3[i] >> 4, '.'); 67 67 caca_putchar(wp->x2[i] >> 4, wp->y2[i] >> 4, 'o'); 68 caca_set_color(CACA_COLOR_WHITE );68 caca_set_color(CACA_COLOR_WHITE, CACA_COLOR_BLACK); 69 69 caca_putchar(wp->x[i] >> 4, wp->y[i] >> 4, '@'); 70 70 break; 71 71 case WEAPON_BOMB: 72 caca_set_color(CACA_COLOR_DARKGRAY );72 caca_set_color(CACA_COLOR_DARKGRAY, CACA_COLOR_BLACK); 73 73 caca_putchar((wp->x[i] - wp->vx[i]) >> 4, (wp->y[i] - wp->vy[i]) >> 4, '.'); 74 74 caca_putchar((wp->x3[i] - wp->vx[i]) >> 4, (wp->y3[i] - wp->vy[i]) >> 4, '.'); … … 355 355 { 356 356 case 24: 357 caca_set_color(CACA_COLOR_WHITE );357 caca_set_color(CACA_COLOR_WHITE, CACA_COLOR_BLACK); 358 358 caca_putstr(x, y-3, "__"); 359 359 caca_putchar(x-1, y-2, '\''); … … 361 361 break; 362 362 case 23: 363 caca_set_color(CACA_COLOR_CYAN );363 caca_set_color(CACA_COLOR_CYAN, CACA_COLOR_BLACK); 364 364 caca_putstr(x, y-3, "__"); 365 caca_set_color(CACA_COLOR_WHITE );365 caca_set_color(CACA_COLOR_WHITE, CACA_COLOR_BLACK); 366 366 caca_putstr(x-2, y-2, "-'"); 367 367 caca_putstr(x+2, y-2, "`-"); 368 368 break; 369 369 case 22: 370 caca_set_color(CACA_COLOR_CYAN );370 caca_set_color(CACA_COLOR_CYAN, CACA_COLOR_BLACK); 371 371 caca_putstr(x, y-3, "__"); 372 372 caca_putchar(x-1, y-2, '\''); 373 373 caca_putchar(x+2, y-2, '`'); 374 caca_set_color(CACA_COLOR_WHITE );374 caca_set_color(CACA_COLOR_WHITE, CACA_COLOR_BLACK); 375 375 caca_putstr(x-3, y-2, ",-"); 376 376 caca_putstr(x+3, y-2, "-."); 377 377 break; 378 378 case 21: 379 caca_set_color(CACA_COLOR_CYAN );379 caca_set_color(CACA_COLOR_CYAN, CACA_COLOR_BLACK); 380 380 caca_putstr(x-1, y-3, "____"); 381 381 caca_putchar(x-2, y-2, '\''); 382 382 caca_putchar(x+3, y-2, '`'); 383 caca_set_color(CACA_COLOR_WHITE );383 caca_set_color(CACA_COLOR_WHITE, CACA_COLOR_BLACK); 384 384 caca_putstr(x-4, y-2, ",-"); 385 385 caca_putstr(x+4, y-2, "-."); 386 386 break; 387 387 case 20: 388 caca_set_color(CACA_COLOR_WHITE );388 caca_set_color(CACA_COLOR_WHITE, CACA_COLOR_BLACK); 389 389 caca_putstr(x, y-3, "%%"); 390 390 caca_putchar(x-4, y-2, ','); 391 391 caca_putchar(x+5, y-2, '.'); 392 caca_set_color(CACA_COLOR_CYAN );392 caca_set_color(CACA_COLOR_CYAN, CACA_COLOR_BLACK); 393 393 caca_putchar(x-1, y-3, ':'); 394 394 caca_putchar(x+2, y-3, ':'); … … 397 397 break; 398 398 case 19: 399 caca_set_color(CACA_COLOR_WHITE );399 caca_set_color(CACA_COLOR_WHITE, CACA_COLOR_BLACK); 400 400 caca_putstr(x, y-4, "%%"); 401 401 caca_putstr(x, y-3, "##"); 402 caca_set_color(CACA_COLOR_CYAN );402 caca_set_color(CACA_COLOR_CYAN, CACA_COLOR_BLACK); 403 403 caca_putchar(x-1, y-4, ':'); 404 404 caca_putchar(x+2, y-4, ':'); … … 407 407 caca_putstr(x-4, y-2, ",-'"); 408 408 caca_putstr(x+3, y-2, "`-."); 409 caca_set_color(CACA_COLOR_BLUE );409 caca_set_color(CACA_COLOR_BLUE, CACA_COLOR_BLACK); 410 410 caca_putchar(x-2, y-3, ':'); 411 411 caca_putchar(x+3, y-3, ':'); … … 414 414 default: 415 415 r = (18 - frame) * (18 - frame); 416 caca_set_color(CACA_COLOR_WHITE );416 caca_set_color(CACA_COLOR_WHITE, CACA_COLOR_BLACK); 417 417 caca_putstr(x-1, y-5-r, ":%%:"); 418 418 caca_putstr(x-1, y-4-r, "%##%"); 419 caca_set_color(CACA_COLOR_CYAN );419 caca_set_color(CACA_COLOR_CYAN, CACA_COLOR_BLACK); 420 420 caca_putchar(x-2, y-4-r, ':'); 421 421 caca_putchar(x+3, y-4-r, ':'); 422 422 caca_putchar(x-2, y-2, '\''); 423 423 caca_putchar(x+3, y-2, '`'); 424 caca_set_color(CACA_COLOR_BLUE );424 caca_set_color(CACA_COLOR_BLUE, CACA_COLOR_BLACK); 425 425 caca_putchar(x-3, y-2, ':'); 426 426 caca_putchar(x+4, y-2, ':'); 427 427 for(i = 0; i <= r; i++) 428 428 { 429 caca_set_color(CACA_COLOR_WHITE );429 caca_set_color(CACA_COLOR_WHITE, CACA_COLOR_BLACK); 430 430 caca_putstr(x-1, y-3-i, ((i+frame) % 5) ? "####" : "%%%%"); 431 caca_set_color(CACA_COLOR_CYAN );431 caca_set_color(CACA_COLOR_CYAN, CACA_COLOR_BLACK); 432 432 caca_putchar(x-2, y-3-i, '%'); 433 433 caca_putchar(x+3, y-3-i, '%'); 434 caca_set_color(CACA_COLOR_BLUE );434 caca_set_color(CACA_COLOR_BLUE, CACA_COLOR_BLACK); 435 435 caca_putchar(x-3, y-3-i, ':'); 436 436 caca_putchar(x+4, y-3-i, ':'); … … 445 445 446 446 /* Lots of duplicate pixels, but we don't care */ 447 caca_set_color(CACA_COLOR_BLUE );447 caca_set_color(CACA_COLOR_BLUE, CACA_COLOR_BLACK); 448 448 caca_draw_ellipse(x, y, r, r / 2, ':'); 449 caca_draw_ellipse(x, y, r + 1, r / 2, ':'); 450 caca_draw_ellipse(x, y, r + 2, r / 2, ':'); 451 caca_set_color(CACA_COLOR_CYAN); 452 caca_draw_ellipse(x, y, r + 2, r / 2 + 1, '%'); 453 caca_draw_ellipse(x, y, r + 3, r / 2 + 1, '%'); 454 caca_set_color(CACA_COLOR_WHITE); 449 caca_set_color(CACA_COLOR_LIGHTBLUE, CACA_COLOR_BLUE); 450 caca_draw_ellipse(x, y, r + 1, r / 2, '#'); 451 caca_set_color(CACA_COLOR_BLUE, CACA_COLOR_LIGHTBLUE); 452 caca_draw_ellipse(x, y, r + 2, r / 2, '#'); 453 caca_set_color(CACA_COLOR_CYAN, CACA_COLOR_LIGHTBLUE); 454 caca_draw_ellipse(x, y, r + 2, r / 2 + 1, '#'); 455 caca_set_color(CACA_COLOR_LIGHTBLUE, CACA_COLOR_CYAN); 456 caca_draw_ellipse(x, y, r + 3, r / 2 + 1, '#'); 457 caca_set_color(CACA_COLOR_WHITE, CACA_COLOR_CYAN); 455 458 caca_draw_ellipse(x, y, r + 3, r / 2 + 2, '#'); 459 caca_set_color(CACA_COLOR_CYAN, CACA_COLOR_WHITE); 456 460 caca_draw_ellipse(x, y, r + 4, r / 2 + 2, '#'); 457 caca_draw_ellipse(x, y, r + 4, r / 2 + 3, ' #');458 } 459 461 caca_draw_ellipse(x, y, r + 4, r / 2 + 3, ' '); 462 } 463
Note: See TracChangeset
for help on using the changeset viewer.