Changeset 2990 for ttyvaders


Ignore:
Timestamp:
Oct 18, 2008, 11:42:24 PM (11 years ago)
Author:
Sam Hocevar
Message:

Port ttyvaders to the unified libcaca 0.99.beta15 API.

Location:
ttyvaders/trunk
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • ttyvaders/trunk/bootstrap

    r989 r2990  
    11#! /bin/sh
     2# $Id$
    23
    3 # bootstrap: the ultimate bootstrap/autogen.sh script for autotools projects
    4 # Copyright (c) 2002, 2003, 2004, 2005, 2006 Sam Hocevar <sam@zoy.org>
     4# bootstrap: generic bootstrap/autogen.sh script for autotools projects
    55#
    6 #    This program is free software; you can redistribute it and/or
    7 #    modify it under the terms of the Do What The Fuck You Want To
    8 #    Public License, Version 2, as published by Sam Hocevar. See
     6# Copyright (c) 2002-2007 Sam Hocevar <sam@zoy.org>
     7#
     8#    This program is free software. It comes without any warranty, to
     9#    the extent permitted by applicable law. You can redistribute it
     10#    and/or modify it under the terms of the Do What The Fuck You Want
     11#    To Public License, Version 2, as published by Sam Hocevar. See
    912#    http://sam.zoy.org/wtfpl/COPYING for more details.
    1013#
     
    2629
    2730# Check for needed features
    28 auxdir="`sed -ne 's/^[ \t]*A._CONFIG_AUX_DIR *( *\([^ )]*\).*/\1/p' $conffile`"
     31auxdir="`sed -ne 's/^[ \t]*A._CONFIG_AUX_DIR *([[ ]*\([^] )]*\).*/\1/p' $conffile`"
    2932libtool="`grep -q '^[ \t]*A._PROG_LIBTOOL' $conffile && echo yes || echo no`"
     33pkgconfig="`grep -q '^[ \t]*PKG_PROG_PKG_CONFIG' $conffile && echo yes || echo no`"
    3034header="`grep -q '^[ \t]*A._CONFIG_HEADER' $conffile && echo yes || echo no`"
    3135aclocalflags="`sed -ne 's/^[ \t]*ACLOCAL_AMFLAGS[ \t]*=//p' Makefile.am`"
     
    3337# Check for automake
    3438amvers="no"
    35 for v in "-1.9" "19" "-1.8" "18" "-1.7" "17" "-1.6" "16" "-1.5" "15"; do
    36   if automake${v} --version >/dev/null 2>&1; then
    37     amvers="${v}"
     39for v in 10 9 8 7 6 5; do
     40  if automake-1.${v} --version >/dev/null 2>&1; then
     41    amvers="-1.${v}"
     42    break
     43  elif automake1.${v} --version >/dev/null 2>&1; then
     44    amvers="1.${v}"
    3845    break
    3946  fi
     
    8895fi
    8996
     97# Check for pkg-config
     98if test "$pkgconfig" = "yes"; then
     99  if ! pkg-config --version >/dev/null 2>&1; then
     100    echo "$0: you need pkg-config"
     101    exit 1
     102  fi
     103fi
     104
    90105# Remove old cruft
    91106for x in aclocal.m4 configure config.guess config.log config.sub config.cache config.h.in config.h compile libtool.m4 ltoptions.m4 ltsugar.m4 ltversion.m4 ltmain.sh libtool ltconfig missing mkinstalldirs depcomp install-sh; do rm -f $x autotools/$x; if test -n "$auxdir"; then rm -f "$auxdir/$x"; fi; done
    92107rm -Rf autom4te.cache
    93 if test -n "$auxdir" -a ! -d "$auxdir"; then mkdir "$auxdir"; fi
     108if test -n "$auxdir"; then
     109  if test ! -d "$auxdir"; then
     110    mkdir "$auxdir"
     111  fi
     112  aclocalflags="${aclocalflags} -I $auxdir -I ."
     113fi
    94114
    95115# Explain what we are doing from now
     
    99119if test "$libtool" = "yes"; then
    100120  ${libtoolize} --copy --force
    101   if test -n "$auxdir" -a -f "ltmain.sh"; then
     121  if test -n "$auxdir" -a ! "$auxdir" = "." -a -f "ltmain.sh"; then
    102122    echo "$0: working around a minor libtool issue"
    103123    mv ltmain.sh "$auxdir/"
     
    105125fi
    106126
    107 if test -n "$auxdir"; then
    108   aclocal${amvers} -I autotools ${aclocalflags}
    109 else
    110   aclocal${amvers} ${aclocalflags}
    111 fi
     127aclocal${amvers} ${aclocalflags}
    112128autoconf${acvers}
    113129if test "$header" = "yes"; then
  • ttyvaders/trunk/configure.ac

    r1444 r2990  
    2727
    2828CACA="no"
    29 PKG_CHECK_MODULES(CACA, caca >= 0.99.beta9,
     29PKG_CHECK_MODULES(CACA, caca >= 0.99.beta15,
    3030 [CACA="yes"],
    3131 [AC_MSG_RESULT(no)
    32   AC_MSG_ERROR([you need libcaca version 0.99.beta9 or later])])
     32  AC_MSG_ERROR([you need libcaca version 0.99.beta15 or later])])
    3333
    3434# Optimizations
  • ttyvaders/trunk/src/aliens.c

    r1460 r2990  
    1919#include "common.h"
    2020
    21 cucul_canvas_t *foo_sprite;
    22 cucul_canvas_t *bar_sprite;
    23 cucul_canvas_t *baz_sprite;
     21caca_canvas_t *foo_sprite;
     22caca_canvas_t *bar_sprite;
     23caca_canvas_t *baz_sprite;
    2424
    2525void init_aliens(game *g, aliens *al)
    2626{
    27     cucul_buffer_t *b;
     27    caca_buffer_t *b;
    2828    int i;
    2929
     
    3333    }
    3434
    35     b = cucul_load_file("data/foofight.caca");
    36     foo_sprite = cucul_import_canvas(b, "");
    37     cucul_free_buffer(b);
     35    b = caca_load_file("data/foofight.caca");
     36    foo_sprite = caca_import_canvas(b, "");
     37    caca_free_buffer(b);
    3838
    39     b = cucul_load_file("data/barfight.caca");
    40     bar_sprite = cucul_import_canvas(b, "");
    41     cucul_free_buffer(b);
     39    b = caca_load_file("data/barfight.caca");
     40    bar_sprite = caca_import_canvas(b, "");
     41    caca_free_buffer(b);
    4242
    43     b = cucul_load_file("data/bazfight.caca");
    44     baz_sprite = cucul_import_canvas(b, "");
    45     cucul_free_buffer(b);
     43    b = caca_load_file("data/bazfight.caca");
     44    baz_sprite = caca_import_canvas(b, "");
     45    caca_free_buffer(b);
    4646}
    4747
     
    5555        {
    5656            case ALIEN_FOO:
    57                 cucul_set_canvas_frame(foo_sprite, al->img[i] % 5);
    58                 cucul_blit(g->cv, al->x[i], al->y[i], foo_sprite, NULL);
     57                caca_set_canvas_frame(foo_sprite, al->img[i] % 5);
     58                caca_blit(g->cv, al->x[i], al->y[i], foo_sprite, NULL);
    5959                break;
    6060            case ALIEN_BAR:
    61                 cucul_set_canvas_frame(bar_sprite, al->img[i] % 2);
    62                 cucul_blit(g->cv, al->x[i], al->y[i], bar_sprite, NULL);
     61                caca_set_canvas_frame(bar_sprite, al->img[i] % 2);
     62                caca_blit(g->cv, al->x[i], al->y[i], bar_sprite, NULL);
    6363                break;
    6464            case ALIEN_BAZ:
    65                 cucul_set_canvas_frame(baz_sprite, al->img[i] % 4);
    66                 cucul_blit(g->cv, al->x[i], al->y[i], baz_sprite, NULL);
     65                caca_set_canvas_frame(baz_sprite, al->img[i] % 4);
     66                caca_blit(g->cv, al->x[i], al->y[i], baz_sprite, NULL);
    6767                break;
    6868            case ALIEN_NONE:
     
    8383            add_explosion(g, g->ex, al->x[i], al->y[i], 0, 0, EXPLOSION_MEDIUM);
    8484            al->type[i] = ALIEN_NONE;
    85             add_bonus(g, g->bo, al->x[i], al->y[i], cucul_rand(0,4) ? BONUS_GREEN : BONUS_LIFE);
     85            add_bonus(g, g->bo, al->x[i], al->y[i], caca_rand(0,4) ? BONUS_GREEN : BONUS_LIFE);
    8686        }
    8787
  • ttyvaders/trunk/src/bonus.c

    r1460 r2990  
    1919#include "common.h"
    2020
    21 cucul_canvas_t *heart_sprite;
    22 cucul_canvas_t *gem_sprite;
     21caca_canvas_t *heart_sprite;
     22caca_canvas_t *gem_sprite;
    2323
    2424void init_bonus(game *g, bonus *bo)
    2525{
    26     cucul_buffer_t *b;
     26    caca_buffer_t *b;
    2727    int i;
    2828
     
    3232    }
    3333
    34     b = cucul_load_file("data/bonheart.caca");
    35     heart_sprite = cucul_import_canvas(b, "");
    36     cucul_free_buffer(b);
     34    b = caca_load_file("data/bonheart.caca");
     35    heart_sprite = caca_import_canvas(b, "");
     36    caca_free_buffer(b);
    3737
    38     b = cucul_load_file("data/bongem.caca");
    39     gem_sprite = cucul_import_canvas(b, "");
    40     cucul_free_buffer(b);
     38    b = caca_load_file("data/bongem.caca");
     39    gem_sprite = caca_import_canvas(b, "");
     40    caca_free_buffer(b);
    4141}
    4242
     
    5050        {
    5151            case BONUS_GREEN:
    52                 cucul_set_canvas_frame(gem_sprite, (bo->n[i]/2 % 3) ? 0 : 1);
    53                 cucul_blit(g->cv, bo->x[i], bo->y[i], gem_sprite, NULL);
     52                caca_set_canvas_frame(gem_sprite, (bo->n[i]/2 % 3) ? 0 : 1);
     53                caca_blit(g->cv, bo->x[i], bo->y[i], gem_sprite, NULL);
    5454                break;
    5555            case BONUS_LIFE:
    56                 cucul_set_canvas_frame(heart_sprite, (bo->n[i] % 3) ? 0 : 1);
    57                 cucul_blit(g->cv, bo->x[i], bo->y[i], heart_sprite, NULL);
     56                caca_set_canvas_frame(heart_sprite, (bo->n[i] % 3) ? 0 : 1);
     57                caca_blit(g->cv, bo->x[i], bo->y[i], heart_sprite, NULL);
    5858                break;
    5959            case BONUS_NONE:
  • ttyvaders/trunk/src/box.c

    r1460 r2990  
    3838    int j, frame;
    3939
    40     cucul_set_color(g->cv, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK);
     40    caca_set_color(g->cv, CACA_COLOR_YELLOW, CACA_COLOR_BLACK);
    4141
    4242    /* Draw the thin horizontal line */
    4343    if(b->frame < 8)
    4444    {
    45         cucul_draw_line(g->cv, b->x - b->w * b->frame / 16, b->y,
     45        caca_draw_line(g->cv, b->x - b->w * b->frame / 16, b->y,
    4646                               b->x + b->w * b->frame / 16 - 1, b->y, "X");
    4747        return;
     
    5151    frame = b->frame < 12 ? b->frame : 12;
    5252
    53     cucul_draw_line(g->cv, b->x - b->w / 2, b->y - b->h * (frame - 8) / 8,
     53    caca_draw_line(g->cv, b->x - b->w / 2, b->y - b->h * (frame - 8) / 8,
    5454                    b->x + b->w / 2 - 1, b->y - b->h * (frame - 8) / 8, "X");
    55     cucul_draw_line(g->cv, b->x - b->w / 2, b->y + b->h * (frame - 8) / 8,
     55    caca_draw_line(g->cv, b->x - b->w / 2, b->y + b->h * (frame - 8) / 8,
    5656                    b->x + b->w / 2 - 1, b->y + b->h * (frame - 8) / 8, "X");
    5757
    58     cucul_draw_line(g->cv, b->x - b->w / 2, b->y - b->h * (frame - 8) / 8,
     58    caca_draw_line(g->cv, b->x - b->w / 2, b->y - b->h * (frame - 8) / 8,
    5959                    b->x - b->w / 2, b->y + b->h * (frame - 8) / 8 - 1, "X");
    60     cucul_draw_line(g->cv, b->x + b->w / 2 - 1, b->y - b->h * (frame - 8) / 8,
     60    caca_draw_line(g->cv, b->x + b->w / 2 - 1, b->y - b->h * (frame - 8) / 8,
    6161               b->x + b->w / 2 - 1, b->y + b->h * (frame - 8) / 8 - 1, "X");
    6262
    63     cucul_set_color(g->cv, CUCUL_COLOR_BLACK, CUCUL_COLOR_BLACK);
     63    caca_set_color(g->cv, CACA_COLOR_BLACK, CACA_COLOR_BLACK);
    6464
    6565    for(j = b->y - b->h * (frame - 8) / 8 + 1;
     
    6767         j++)
    6868    {
    69         cucul_draw_line(g->cv, b->x - b->w / 2 + 1, j,
     69        caca_draw_line(g->cv, b->x - b->w / 2 + 1, j,
    7070                        b->x + b->w / 2 - 2, j, "X");
    7171    }
     
    7777
    7878    /* Draw the text inside the frame */
    79     cucul_set_color(g->cv, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK);
     79    caca_set_color(g->cv, CACA_COLOR_YELLOW, CACA_COLOR_BLACK);
    8080
    8181    /* FIXME: use a font */
    82     cucul_putstr(g->cv, b->x - b->w / 2 + 12, b->y - b->h / 2 + 2,
     82    caca_putstr(g->cv, b->x - b->w / 2 + 12, b->y - b->h / 2 + 2,
    8383                 "XXXX.  .XXXX  X   X  .XXXX  .XXXX  XXXX.");
    84     cucul_putstr(g->cv, b->x - b->w / 2 + 12, b->y - b->h / 2 + 3,
     84    caca_putstr(g->cv, b->x - b->w / 2 + 12, b->y - b->h / 2 + 3,
    8585                 "X  `X  X'  X  X   X  X'     X'     X  `X");
    86     cucul_putstr(g->cv, b->x - b->w / 2 + 12, b->y - b->h / 2 + 4,
     86    caca_putstr(g->cv, b->x - b->w / 2 + 12, b->y - b->h / 2 + 4,
    8787                 "XXXX'  XXXXX  X   X  `XXX   XXXX   X   X");
    88     cucul_putstr(g->cv, b->x - b->w / 2 + 12, b->y - b->h / 2 + 5,
     88    caca_putstr(g->cv, b->x - b->w / 2 + 12, b->y - b->h / 2 + 5,
    8989                 "X'     X' `X  X. ,X     `X  X'     X  ,X");
    90     cucul_putstr(g->cv, b->x - b->w / 2 + 12, b->y - b->h / 2 + 6,
     90    caca_putstr(g->cv, b->x - b->w / 2 + 12, b->y - b->h / 2 + 6,
    9191                 "X      X   X  `XXXX  XXXX'  `XXXX  XXXX'");
    9292}
  • ttyvaders/trunk/src/ceo.c

    r1460 r2990  
    2828        caca_event_t ev;
    2929
    30         cucul_clear_canvas(g->cv);
     30        caca_clear_canvas(g->cv);
    3131
    3232        if(caca_get_event(g->dp, CACA_EVENT_KEY_PRESS, &ev, 0)
  • ttyvaders/trunk/src/collide.c

    r1460 r2990  
    120120                {
    121121                    add_explosion(g, ex, GET_MIN(t->left[y-j], x+3), y-j, 0, 1, EXPLOSION_SMALL);
    122                     t->left[y-j] -= cucul_rand(0,2);
     122                    t->left[y-j] -= caca_rand(0,2);
    123123                }
    124124                else if(x + 3 >= t->right[y-j])
    125125                {
    126126                    add_explosion(g, ex, GET_MAX(t->right[y-j], x-2), y-j, 0, 1, EXPLOSION_SMALL);
    127                     t->right[y-j] += cucul_rand(0,2);
     127                    t->right[y-j] += caca_rand(0,2);
    128128                }
    129129            }
  • ttyvaders/trunk/src/common.h

    r1460 r2990  
    125125    int w, h;
    126126
    127     cucul_canvas_t *cv;
     127    caca_canvas_t *cv;
    128128    caca_display_t *dp;
    129129
  • ttyvaders/trunk/src/explosions.c

    r1460 r2990  
    1919#include "common.h"
    2020
    21 cucul_canvas_t *medium_sprite;
    22 cucul_canvas_t *small_sprite;
     21caca_canvas_t *medium_sprite;
     22caca_canvas_t *small_sprite;
    2323
    2424void init_explosions(game *g, explosions *ex)
    2525{
    26     cucul_buffer_t *b;
     26    caca_buffer_t *b;
    2727    int i;
    2828
     
    3232    }
    3333
    34     b = cucul_load_file("data/xplmed.caca");
    35     medium_sprite = cucul_import_canvas(b, "");
    36     cucul_free_buffer(b);
     34    b = caca_load_file("data/xplmed.caca");
     35    medium_sprite = caca_import_canvas(b, "");
     36    caca_free_buffer(b);
    3737
    38     b = cucul_load_file("data/xplsmall.caca");
    39     small_sprite = cucul_import_canvas(b, "");
    40     cucul_free_buffer(b);
     38    b = caca_load_file("data/xplsmall.caca");
     39    small_sprite = caca_import_canvas(b, "");
     40    caca_free_buffer(b);
    4141}
    4242
     
    7575    {
    7676#if 0
    77         cucul_set_fg_color(g->cv, CACA_COLOR_GREEN);
    78         cucul_goto(g->cv, ex->x[i] + 3, ex->y[i]);
    79         switch(cucul_rand(0,2))
     77        caca_set_fg_color(g->cv, CACA_COLOR_GREEN);
     78        caca_goto(g->cv, ex->x[i] + 3, ex->y[i]);
     79        switch(caca_rand(0,2))
    8080        {
    8181        case 0:
    82             cucul_putchar(g->cv, 'p');
    83             cucul_putchar(g->cv, 'i');
    84             cucul_putchar(g->cv, 'f');
     82            caca_putchar(g->cv, 'p');
     83            caca_putchar(g->cv, 'i');
     84            caca_putchar(g->cv, 'f');
    8585            break;
    8686        case 1:
    87             cucul_putchar(g->cv, 'p');
    88             cucul_putchar(g->cv, 'a');
    89             cucul_putchar(g->cv, 'f');
     87            caca_putchar(g->cv, 'p');
     88            caca_putchar(g->cv, 'a');
     89            caca_putchar(g->cv, 'f');
    9090            break;
    9191        case 2:
    92             cucul_putchar(g->cv, 'p');
    93             cucul_putchar(g->cv, 'o');
    94             cucul_putchar(g->cv, 'u');
    95             cucul_putchar(g->cv, 'f');
     92            caca_putchar(g->cv, 'p');
     93            caca_putchar(g->cv, 'o');
     94            caca_putchar(g->cv, 'u');
     95            caca_putchar(g->cv, 'f');
    9696            break;
    9797        }
    98         cucul_putchar(g->cv, '!');
     98        caca_putchar(g->cv, '!');
    9999#endif
    100100
     
    102102        {
    103103            case EXPLOSION_MEDIUM:
    104                 cucul_set_canvas_frame(medium_sprite, 10 - ex->n[i]);
    105                 cucul_blit(g->cv, ex->x[i], ex->y[i], medium_sprite, NULL);
     104                caca_set_canvas_frame(medium_sprite, 10 - ex->n[i]);
     105                caca_blit(g->cv, ex->x[i], ex->y[i], medium_sprite, NULL);
    106106                break;
    107107            case EXPLOSION_SMALL:
    108                 cucul_set_canvas_frame(small_sprite, 6 - ex->n[i]);
    109                 cucul_blit(g->cv, ex->x[i], ex->y[i], small_sprite, NULL);
     108                caca_set_canvas_frame(small_sprite, 6 - ex->n[i]);
     109                caca_blit(g->cv, ex->x[i], ex->y[i], small_sprite, NULL);
    110110                break;
    111111            case EXPLOSION_NONE:
  • ttyvaders/trunk/src/intro.c

    r1460 r2990  
    2424{
    2525    caca_event_t ev;
    26     cucul_canvas_t *foo_sprite;
    27     cucul_canvas_t *bar_sprite;
    28     cucul_canvas_t *baz_sprite;
    29     cucul_buffer_t *b;
     26    caca_canvas_t *foo_sprite;
     27    caca_canvas_t *bar_sprite;
     28    caca_canvas_t *baz_sprite;
     29    caca_buffer_t *b;
    3030    int frame = 0;
    3131
    32     b = cucul_load_file("data/foofight.caca");
    33     foo_sprite = cucul_import_canvas(b, "");
    34     cucul_free_buffer(b);
     32    b = caca_load_file("data/foofight.caca");
     33    foo_sprite = caca_import_canvas(b, "");
     34    caca_free_buffer(b);
    3535
    36     b = cucul_load_file("data/barfight.caca");
    37     bar_sprite = cucul_import_canvas(b, "");
    38     cucul_free_buffer(b);
     36    b = caca_load_file("data/barfight.caca");
     37    bar_sprite = caca_import_canvas(b, "");
     38    caca_free_buffer(b);
    3939
    40     b = cucul_load_file("data/bazfight.caca");
    41     baz_sprite = cucul_import_canvas(b, "");
    42     cucul_free_buffer(b);
     40    b = caca_load_file("data/bazfight.caca");
     41    baz_sprite = caca_import_canvas(b, "");
     42    caca_free_buffer(b);
    4343
    4444    while(caca_get_event(g->dp, CACA_EVENT_KEY_PRESS, &ev, 0) == 0)
     
    4848        frame++;
    4949
    50         cucul_clear_canvas(g->cv);
     50        caca_clear_canvas(g->cv);
    5151
    52         xo = cucul_get_canvas_width(g->cv) / 2;
    53         yo = cucul_get_canvas_height(g->cv) / 2;
     52        xo = caca_get_canvas_width(g->cv) / 2;
     53        yo = caca_get_canvas_height(g->cv) / 2;
    5454
    55         cucul_set_color(g->cv, CUCUL_COLOR_RED, CUCUL_COLOR_BLACK);
    56         cucul_fill_ellipse(g->cv, xo, yo, 16, 8, "#");
    57         cucul_set_color(g->cv, CUCUL_COLOR_GREEN, CUCUL_COLOR_BLACK);
    58         cucul_draw_thin_ellipse(g->cv, xo, yo, 16, 8);
     55        caca_set_color(g->cv, CACA_COLOR_RED, CACA_COLOR_BLACK);
     56        caca_fill_ellipse(g->cv, xo, yo, 16, 8, "#");
     57        caca_set_color(g->cv, CACA_COLOR_GREEN, CACA_COLOR_BLACK);
     58        caca_draw_thin_ellipse(g->cv, xo, yo, 16, 8);
    5959
    6060        for(i = 0; i < 4; i ++)
     
    6666        y[4] = y[0];
    6767
    68         cucul_set_color(g->cv, CUCUL_COLOR_BLACK, CUCUL_COLOR_BLACK);
    69         cucul_fill_triangle(g->cv, x[0], y[0], x[1], y[1], x[2], y[2], " ");
    70         cucul_fill_triangle(g->cv, x[0], y[0], x[3], y[3], x[2], y[2], " ");
    71         cucul_draw_line(g->cv, x[0], y[0], x[2], y[2], " ");
    72         cucul_set_color(g->cv, CUCUL_COLOR_GREEN, CUCUL_COLOR_BLACK);
    73         cucul_draw_thin_polyline(g->cv, x, y, 4);
     68        caca_set_color(g->cv, CACA_COLOR_BLACK, CACA_COLOR_BLACK);
     69        caca_fill_triangle(g->cv, x[0], y[0], x[1], y[1], x[2], y[2], " ");
     70        caca_fill_triangle(g->cv, x[0], y[0], x[3], y[3], x[2], y[2], " ");
     71        caca_draw_line(g->cv, x[0], y[0], x[2], y[2], " ");
     72        caca_set_color(g->cv, CACA_COLOR_GREEN, CACA_COLOR_BLACK);
     73        caca_draw_thin_polyline(g->cv, x, y, 4);
    7474
    75         cucul_set_canvas_frame(foo_sprite, frame % 5);
    76         cucul_blit(g->cv, xo, yo, foo_sprite, NULL);
     75        caca_set_canvas_frame(foo_sprite, frame % 5);
     76        caca_blit(g->cv, xo, yo, foo_sprite, NULL);
    7777
    7878        caca_refresh_display(g->dp);
  • ttyvaders/trunk/src/main.c

    r1460 r2990  
    3434    srand(time(NULL));
    3535
    36     g->cv = cucul_create_canvas(0, 0);
     36    g->cv = caca_create_canvas(0, 0);
    3737    if(!g->cv)
    3838        return 1;
     
    4545
    4646    /* Initialize our program */
    47     g->w = cucul_get_canvas_width(g->cv);
    48     g->h = cucul_get_canvas_height(g->cv);
     47    g->w = caca_get_canvas_width(g->cv);
     48    g->h = caca_get_canvas_height(g->cv);
    4949
    5050intro(g);
     
    5555    /* Clean up */
    5656    caca_free_display(g->dp);
    57     cucul_free_canvas(g->cv);
     57    caca_free_canvas(g->cv);
    5858
    5959    return 0;
     
    195195
    196196            /* XXX: to be removed */
    197             if(cucul_rand(0, 9) == 0)
     197            if(caca_rand(0, 9) == 0)
    198198            {
    199199                int list[3] = { ALIEN_FOO, ALIEN_BAR, ALIEN_BAZ };
    200200
    201                 add_alien(g, g->al, 0, rand() % g->h / 2, list[cucul_rand(0,2)]);
     201                add_alien(g, g->al, 0, rand() % g->h / 2, list[caca_rand(0,2)]);
    202202            }
    203203
     
    228228
    229229        /* Clear screen */
    230         cucul_clear_canvas(g->cv);
     230        caca_clear_canvas(g->cv);
    231231
    232232        /* Print starfield, tunnel, aliens, player and explosions */
  • ttyvaders/trunk/src/overlay.c

    r1460 r2990  
    2525
    2626    /* Draw life jauge */
    27     cucul_set_color(g->cv, CUCUL_COLOR_DARKGRAY, CUCUL_COLOR_BLACK);
    28     cucul_putstr(g->cv, 4, 1, dots30);
     27    caca_set_color(g->cv, CACA_COLOR_DARKGRAY, CACA_COLOR_BLACK);
     28    caca_putstr(g->cv, 4, 1, dots30);
    2929
    3030    if(g->p->life > MAX_LIFE * 7 / 10)
    3131    {
    32         cucul_set_color(g->cv, CUCUL_COLOR_GREEN, CUCUL_COLOR_BLACK);
     32        caca_set_color(g->cv, CACA_COLOR_GREEN, CACA_COLOR_BLACK);
    3333    }
    3434    else if(g->p->life > MAX_LIFE * 3 / 10)
    3535    {
    36         cucul_set_color(g->cv, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK);
     36        caca_set_color(g->cv, CACA_COLOR_YELLOW, CACA_COLOR_BLACK);
    3737    }
    3838    else
    3939    {
    40         cucul_set_color(g->cv, CUCUL_COLOR_RED, CUCUL_COLOR_BLACK);
     40        caca_set_color(g->cv, CACA_COLOR_RED, CACA_COLOR_BLACK);
    4141    }
    4242
    43     cucul_putstr(g->cv, 4, 1, dashes30 + (MAX_LIFE - g->p->life) * 30 / MAX_LIFE);
     43    caca_putstr(g->cv, 4, 1, dashes30 + (MAX_LIFE - g->p->life) * 30 / MAX_LIFE);
    4444
    45     cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK);
    46     cucul_putstr(g->cv, 1, 1, "L |");
    47     cucul_putstr(g->cv, 34, 1, "|");
     45    caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_BLACK);
     46    caca_putstr(g->cv, 1, 1, "L |");
     47    caca_putstr(g->cv, 34, 1, "|");
    4848
    4949    /* Draw weapon jauge */
    50     cucul_set_color(g->cv, CUCUL_COLOR_DARKGRAY, CUCUL_COLOR_BLACK);
    51     cucul_putstr(g->cv, 42, 1, dots30 + 10);
     50    caca_set_color(g->cv, CACA_COLOR_DARKGRAY, CACA_COLOR_BLACK);
     51    caca_putstr(g->cv, 42, 1, dots30 + 10);
    5252
    5353    if(g->p->special > MAX_SPECIAL * 9 / 10)
    5454    {
    55         cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK);
     55        caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_BLACK);
    5656    }
    5757    else if(g->p->special > MAX_SPECIAL * 3 / 10)
    5858    {
    59         cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK);
     59        caca_set_color(g->cv, CACA_COLOR_CYAN, CACA_COLOR_BLACK);
    6060    }
    6161    else
    6262    {
    63         cucul_set_color(g->cv, CUCUL_COLOR_BLUE, CUCUL_COLOR_BLACK);
     63        caca_set_color(g->cv, CACA_COLOR_BLUE, CACA_COLOR_BLACK);
    6464    }
    6565
    66     cucul_putstr(g->cv, 42, 1, dashes30 + 10
     66    caca_putstr(g->cv, 42, 1, dashes30 + 10
    6767                       + (MAX_SPECIAL - g->p->special) * 20 / MAX_SPECIAL);
    6868
    69     cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK);
    70     cucul_putstr(g->cv, 39, 1, "S |");
    71     cucul_putstr(g->cv, 62, 1, "|");
     69    caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_BLACK);
     70    caca_putstr(g->cv, 39, 1, "S |");
     71    caca_putstr(g->cv, 62, 1, "|");
    7272}
    7373
  • ttyvaders/trunk/src/player.c

    r1460 r2990  
    1919#include "common.h"
    2020
    21 cucul_canvas_t *ship_sprite;
     21caca_canvas_t *ship_sprite;
    2222
    2323/* Init tunnel */
    2424player * create_player(game *g)
    2525{
    26     cucul_buffer_t *b;
     26    caca_buffer_t *b;
    2727
    2828    player *p = malloc(sizeof(player));
     
    3939    p->dead = 0;
    4040
    41     b = cucul_load_file("data/ship.caca");
    42     ship_sprite = cucul_import_canvas(b, "");
    43     cucul_free_buffer(b);
     41    b = caca_load_file("data/ship.caca");
     42    ship_sprite = caca_import_canvas(b, "");
     43    caca_free_buffer(b);
    4444
    4545    return p;
     
    5656        return;
    5757
    58     cucul_set_canvas_frame(ship_sprite, 0);
    59     cucul_blit(g->cv, p->x, p->y, ship_sprite, NULL);
     58    caca_set_canvas_frame(ship_sprite, 0);
     59    caca_blit(g->cv, p->x, p->y, ship_sprite, NULL);
    6060}
    6161
  • ttyvaders/trunk/src/starfield.c

    r1460 r2990  
    3030    for(i = 0; i < STARS; i++)
    3131    {
    32         s[i].x = cucul_rand(0, g->w - 1);
    33         s[i].y = cucul_rand(0, g->h - 1);
    34         s[i].z = cucul_rand(1, 3);
    35         s[i].c = cucul_rand(0, 1) ? CUCUL_COLOR_LIGHTGRAY : CUCUL_COLOR_DARKGRAY;
    36         s[i].ch = cucul_rand(0, 1) ? '.' : '\'';
     32        s[i].x = caca_rand(0, g->w - 1);
     33        s[i].y = caca_rand(0, g->h - 1);
     34        s[i].z = caca_rand(1, 3);
     35        s[i].c = caca_rand(0, 1) ? CACA_COLOR_LIGHTGRAY : CACA_COLOR_DARKGRAY;
     36        s[i].ch = caca_rand(0, 1) ? '.' : '\'';
    3737    }
    3838
     
    4848        if(s[i].x >= 0)
    4949        {
    50             cucul_set_color(g->cv, s[i].c, CUCUL_COLOR_BLACK);
    51             cucul_putchar(g->cv, s[i].x, s[i].y, s[i].ch);
     50            caca_set_color(g->cv, s[i].c, CACA_COLOR_BLACK);
     51            caca_putchar(g->cv, s[i].x, s[i].y, s[i].ch);
    5252        }
    5353    }
     
    6262        if(s[i].x < 0)
    6363        {
    64             s[i].x = cucul_rand(0, g->w - 1);
     64            s[i].x = caca_rand(0, g->w - 1);
    6565            s[i].y = 0;
    66             s[i].z = cucul_rand(1, 2);
    67             s[i].c = cucul_rand(0, 1) ? CUCUL_COLOR_LIGHTGRAY : CUCUL_COLOR_DARKGRAY;
    68             s[i].ch = cucul_rand(0, 1) ? '.' : '\'';
     66            s[i].z = caca_rand(1, 2);
     67            s[i].c = caca_rand(0, 1) ? CACA_COLOR_LIGHTGRAY : CACA_COLOR_DARKGRAY;
     68            s[i].ch = caca_rand(0, 1) ? '.' : '\'';
    6969        }
    7070        else if(s[i].y < g->h-1)
  • ttyvaders/trunk/src/ttyvaders.c

    r1460 r2990  
    1919#include <caca.h>
    2020
    21 cucul_canvas_t *cv;
     21caca_canvas_t *cv;
    2222caca_display_t *dp;
    2323
    24 cucul_canvas_t *ship, *alien;
     24caca_canvas_t *ship, *alien;
    2525
    2626unsigned int shipx, shipy;
    2727
    2828unsigned int frame, w, h;
    29 int ground[80];
     29int ground[81];
    3030
    3131static void run_game(void);
     
    3333int main(int argc, char **argv)
    3434{
    35     cucul_buffer_t *b;
    36 
    37     cv = cucul_create_canvas(80, 24);
     35    cv = caca_create_canvas(80, 24);
    3836    if(!cv)
    3937        return 1;
     
    4644
    4745    /* Initialize our program */
    48     w = cucul_get_canvas_width(cv);
    49     h = cucul_get_canvas_height(cv);
     46    w = caca_get_canvas_width(cv);
     47    h = caca_get_canvas_height(cv);
    5048
    5149    /* Load data */
    52     b = cucul_load_file("data/ship.ans");
    53     ship = cucul_import_canvas(b, "");
    54     cucul_free_buffer(b);
    55     b = cucul_load_file("data/alien.ans");
    56     alien = cucul_import_canvas(b, "");
    57     cucul_free_buffer(b);
     50    ship = caca_create_canvas(0, 0);
     51    caca_import_file(ship, "data/ship.ans", "");
     52    alien = caca_create_canvas(0, 0);
     53    caca_import_file(alien, "data/alien.ans", "");
    5854
    5955    /* Go ! */
     
    6258    /* Clean up */
    6359    caca_free_display(dp);
    64     cucul_free_canvas(cv);
     60    caca_free_canvas(cv);
    6561
    6662    return 0;
     
    7975        return;
    8076
    81     ground[80] += cucul_rand(-1, 2);
     77    ground[80] += caca_rand(-1, 2);
    8278    if(ground[80] < 2)
    8379        ground[80] = 3;
     
    10298    {
    10399        /* Draw the sky */
    104         cucul_set_color_ansi(cv, CUCUL_LIGHTBLUE, CUCUL_LIGHTCYAN);
     100        caca_set_color_ansi(cv, CACA_LIGHTBLUE, CACA_LIGHTCYAN);
    105101        for(j = h - 24; j < h - 18 + ((40 - i) * (40 - i) / (40 * 40 / 10)) + (i & 1); j++)
    106             cucul_putchar(cv, i, j, ' ');
    107         cucul_putchar(cv, i, j++, 0x2591);
    108         cucul_putchar(cv, i, j++, 0x2591);
    109         cucul_putchar(cv, i, j++, 0x2591);
    110         cucul_putchar(cv, i, j++, 0x2592);
    111         cucul_putchar(cv, i, j++, 0x2592);
    112         cucul_putchar(cv, i, j++, 0x2592);
    113         cucul_putchar(cv, i, j++, 0x2593);
    114         cucul_putchar(cv, i, j++, 0x2593);
    115         cucul_putchar(cv, i, j++, 0x2593);
    116         cucul_set_color_ansi(cv, CUCUL_LIGHTBLUE, CUCUL_LIGHTBLUE);
     102            caca_put_char(cv, i, j, ' ');
     103        caca_put_char(cv, i, j++, 0x2591);
     104        caca_put_char(cv, i, j++, 0x2591);
     105        caca_put_char(cv, i, j++, 0x2591);
     106        caca_put_char(cv, i, j++, 0x2592);
     107        caca_put_char(cv, i, j++, 0x2592);
     108        caca_put_char(cv, i, j++, 0x2592);
     109        caca_put_char(cv, i, j++, 0x2593);
     110        caca_put_char(cv, i, j++, 0x2593);
     111        caca_put_char(cv, i, j++, 0x2593);
     112        caca_set_color_ansi(cv, CACA_LIGHTBLUE, CACA_LIGHTBLUE);
    117113        for( ; j < h; j++)
    118             cucul_putchar(cv, i, j, ' ');
     114            caca_put_char(cv, i, j, ' ');
    119115
    120116        /* TODO: Draw the mountains */
     
    122118        /* Draw the ground */
    123119        j = h - ground[i];
    124         cucul_set_color_ansi(cv, CUCUL_BLACK, CUCUL_LIGHTBLUE);
    125         if(i >= 4 && ground[i] == ground[i - 6]
     120        caca_set_color_ansi(cv, CACA_BLACK, CACA_LIGHTBLUE);
     121/*        if(i >= 4 && ground[i] == ground[i - 6]
    126122                  && ground[i] != ground[i - 7])
    127123        {
    128             cucul_putstr(cv, i - 3, j - 2,    "Omm");
    129             cucul_putstr(cv, i - 6, j - 1, "(/)-(/)");
    130         }
    131         cucul_set_color_ansi(cv, CUCUL_RED, CUCUL_GREEN);
     124            caca_putstr(cv, i - 3, j - 2,    "Omm");
     125            caca_putstr(cv, i - 6, j - 1, "(/)-(/)");
     126        }*/
     127        caca_set_color_ansi(cv, CACA_RED, CACA_GREEN);
    132128        if(ground[i + 1] > ground[i])
    133             cucul_putchar(cv, i, j++, 0x2588); // UTF-8: 0x259f
     129            caca_put_char(cv, i, j++, 0x2588); // UTF-8: 0x259f
    134130        else if(ground[i + 1] < ground[i])
    135131        {
    136132            j++;
    137             cucul_putchar(cv, i, j++, 0x2588); // UTF-8: 0x2599
     133            caca_put_char(cv, i, j++, 0x2588); // UTF-8: 0x2599
    138134        }
    139135        else
    140             cucul_putchar(cv, i, j++, 0x2584);
    141         cucul_set_color_ansi(cv, CUCUL_RED, CUCUL_BROWN);
    142         cucul_putchar(cv, i, j++, 0x2593);
    143         cucul_putchar(cv, i, j++, 0x2592);
    144         cucul_putchar(cv, i, j++, 0x2591);
     136            caca_put_char(cv, i, j++, 0x2584);
     137        caca_set_color_ansi(cv, CACA_RED, CACA_BROWN);
     138        caca_put_char(cv, i, j++, 0x2593);
     139        caca_put_char(cv, i, j++, 0x2592);
     140        caca_put_char(cv, i, j++, 0x2591);
    145141        for( ; j < h; j++)
    146             cucul_putchar(cv, i, j, ' ');
     142            caca_put_char(cv, i, j, ' ');
    147143    }
    148144}
     
    150146static void display_stuff(void)
    151147{
    152     cucul_blit(cv, shipx, shipy, ship, NULL);
    153     cucul_blit(cv, 68, h - 22, alien, NULL);
    154     cucul_blit(cv, 52, h - 16, alien, NULL);
    155     cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE);
    156     cucul_printf(cv, 2, h - 2, " %i fps ", 1000000 / (1 + caca_get_display_time(dp)));
     148    caca_blit(cv, shipx, shipy, ship, NULL);
     149    caca_blit(cv, 68, h - 22, alien, NULL);
     150    caca_blit(cv, 52, h - 16, alien, NULL);
     151    caca_set_color_ansi(cv, CACA_WHITE, CACA_BLUE);
     152    caca_printf(cv, 2, h - 2, " %i fps ", 1000000 / (1 + caca_get_display_time(dp)));
    157153}
    158154
  • ttyvaders/trunk/src/tunnel.c

    r1460 r2990  
    7070    char c;
    7171
    72     cucul_set_color(g->cv, CUCUL_COLOR_RED, CUCUL_COLOR_BLACK);
     72    caca_set_color(g->cv, CACA_COLOR_RED, CACA_COLOR_BLACK);
    7373
    7474    /* Left border */
     
    8383            c = (i == 0 || t->left[i] > t->left[i-1]) ? '\\' : '<';
    8484
    85         cucul_putchar(g->cv, t->left[i] + 1, i, c);
     85        caca_putchar(g->cv, t->left[i] + 1, i, c);
    8686
    8787        if(i + 1 < g->h)
    8888            for(j = 1; j < t->left[i+1] - t->left[i]; j++)
    89                 cucul_putchar(g->cv, t->left[i] + j + 1, i, '_');
     89                caca_putchar(g->cv, t->left[i] + j + 1, i, '_');
    9090    }
    9191
     
    103103        if(i + 1 < g->h)
    104104            for(j = 1; j < t->right[i] - t->right[i+1]; j++)
    105                 cucul_putchar(g->cv, t->right[i+1] + j - 1, i, '_');
     105                caca_putchar(g->cv, t->right[i+1] + j - 1, i, '_');
    106106
    107         cucul_putchar(g->cv, t->right[i] - 1, i, c);
     107        caca_putchar(g->cv, t->right[i] - 1, i, c);
    108108    }
    109109
    110     cucul_set_color(g->cv, CUCUL_COLOR_LIGHTRED, CUCUL_COLOR_RED);
     110    caca_set_color(g->cv, CACA_COLOR_LIGHTRED, CACA_COLOR_RED);
    111111
    112112    /* Left concrete */
    113113    for(i = 0; i < g->h ; i++)
    114114        for(j = 0 ; j <= t->left[i]; j++)
    115             cucul_putchar(g->cv, j, i, '#');
     115            caca_putchar(g->cv, j, i, '#');
    116116
    117117    /* Right concrete */
    118118    for(i = 0; i < g->h ; i++)
    119119        for(j = t->right[i] ; j < g->w ; j++)
    120             cucul_putchar(g->cv, j, i, '#');
     120            caca_putchar(g->cv, j, i, '#');
    121121}
    122122
     
    134134
    135135    /* Generate new values */
    136     i = delta[cucul_rand(0,5)];
    137     j = delta[cucul_rand(0,5)];
     136    i = delta[caca_rand(0,5)];
     137    j = delta[caca_rand(0,5)];
    138138
    139139    /* Check in which direction we need to alter tunnel */
  • ttyvaders/trunk/src/weapons.c

    r1460 r2990  
    2525static void draw_fragbomb(game *g, int x, int y, int frame);
    2626
    27 cucul_canvas_t *bomb_sprite;
    28 cucul_canvas_t *fragbomb_sprite;
     27caca_canvas_t *bomb_sprite;
     28caca_canvas_t *fragbomb_sprite;
    2929
    3030void init_weapons(game *g, weapons *wp)
    3131{
    32     cucul_buffer_t *b;
     32    caca_buffer_t *b;
    3333    int i;
    3434
     
    3838    }
    3939
    40     b = cucul_load_file("data/wpnbomb.caca");
    41     bomb_sprite = cucul_import_canvas(b, "");
    42     cucul_free_buffer(b);
    43 
    44     b = cucul_load_file("data/wpnfrag.caca");
    45     bomb_sprite = cucul_import_canvas(b, "");
    46     cucul_free_buffer(b);
     40    b = caca_load_file("data/wpnbomb.caca");
     41    bomb_sprite = caca_import_canvas(b, "");
     42    caca_free_buffer(b);
     43
     44    b = caca_load_file("data/wpnfrag.caca");
     45    bomb_sprite = caca_import_canvas(b, "");
     46    caca_free_buffer(b);
    4747}
    4848
     
    5656        {
    5757            case WEAPON_LASER:
    58                 cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK);
    59                 cucul_putchar(g->cv, wp->x[i] >> 4, wp->y[i] >> 4, '|');
    60                 cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK);
    61                 cucul_putchar(g->cv, wp->x[i] >> 4, (wp->y[i] >> 4) + 1, '|');
     58                caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_BLACK);
     59                caca_putchar(g->cv, wp->x[i] >> 4, wp->y[i] >> 4, '|');
     60                caca_set_color(g->cv, CACA_COLOR_CYAN, CACA_COLOR_BLACK);
     61                caca_putchar(g->cv, wp->x[i] >> 4, (wp->y[i] >> 4) + 1, '|');
    6262                break;
    6363            case WEAPON_SEEKER:
    64                 cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK);
    65                 cucul_putchar(g->cv, wp->x3[i] >> 4, wp->y3[i] >> 4, '.');
    66                 cucul_putchar(g->cv, wp->x2[i] >> 4, wp->y2[i] >> 4, 'o');
    67                 cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK);
    68                 cucul_putchar(g->cv, wp->x[i] >> 4, wp->y[i] >> 4, '@');
     64                caca_set_color(g->cv, CACA_COLOR_CYAN, CACA_COLOR_BLACK);
     65                caca_putchar(g->cv, wp->x3[i] >> 4, wp->y3[i] >> 4, '.');
     66                caca_putchar(g->cv, wp->x2[i] >> 4, wp->y2[i] >> 4, 'o');
     67                caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_BLACK);
     68                caca_putchar(g->cv, wp->x[i] >> 4, wp->y[i] >> 4, '@');
    6969                break;
    7070            case WEAPON_BOMB:
    71                 cucul_set_color(g->cv, CUCUL_COLOR_DARKGRAY, CUCUL_COLOR_BLACK);
    72                 cucul_putchar(g->cv, (wp->x[i] - wp->vx[i]) >> 4, (wp->y[i] - wp->vy[i]) >> 4, '.');
    73                 cucul_putchar(g->cv, (wp->x3[i] - wp->vx[i]) >> 4, (wp->y3[i] - wp->vy[i]) >> 4, '.');
    74                 cucul_putchar(g->cv, (wp->x2[i] - wp->vx[i]) >> 4, (wp->y2[i] - wp->vy[i]) >> 4, '.');
    75                 cucul_putchar(g->cv, wp->x3[i] >> 4, wp->y3[i] >> 4, '.');
    76                 cucul_putchar(g->cv, wp->x2[i] >> 4, wp->y2[i] >> 4, '.');
     71                caca_set_color(g->cv, CACA_COLOR_DARKGRAY, CACA_COLOR_BLACK);
     72                caca_putchar(g->cv, (wp->x[i] - wp->vx[i]) >> 4, (wp->y[i] - wp->vy[i]) >> 4, '.');
     73                caca_putchar(g->cv, (wp->x3[i] - wp->vx[i]) >> 4, (wp->y3[i] - wp->vy[i]) >> 4, '.');
     74                caca_putchar(g->cv, (wp->x2[i] - wp->vx[i]) >> 4, (wp->y2[i] - wp->vy[i]) >> 4, '.');
     75                caca_putchar(g->cv, wp->x3[i] >> 4, wp->y3[i] >> 4, '.');
     76                caca_putchar(g->cv, wp->x2[i] >> 4, wp->y2[i] >> 4, '.');
    7777                draw_bomb(g, wp->x[i] >> 4, wp->y[i] >> 4, wp->vx[i], wp->vy[i]);
    7878                break;
     
    334334    }
    335335
    336     cucul_set_canvas_frame(bomb_sprite, frame);
    337     cucul_blit(g->cv, x, y, bomb_sprite, NULL);
     336    caca_set_canvas_frame(bomb_sprite, frame);
     337    caca_blit(g->cv, x, y, bomb_sprite, NULL);
    338338}
    339339
     
    341341{
    342342    /* Draw the head */
    343     cucul_set_canvas_frame(fragbomb_sprite, frame & 1);
    344     cucul_blit(g->cv, x, y, fragbomb_sprite, NULL);
     343    caca_set_canvas_frame(fragbomb_sprite, frame & 1);
     344    caca_blit(g->cv, x, y, fragbomb_sprite, NULL);
    345345
    346346    /* Draw the tail */
    347     cucul_set_canvas_frame(fragbomb_sprite, 2 + (frame % 4));
    348     cucul_blit(g->cv, x, y, fragbomb_sprite, NULL);
     347    caca_set_canvas_frame(fragbomb_sprite, 2 + (frame % 4));
     348    caca_blit(g->cv, x, y, fragbomb_sprite, NULL);
    349349}
    350350
     
    357357    {
    358358        case 24:
    359             cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK);
    360             cucul_putstr(g->cv, x, y-3, "__");
    361             cucul_putchar(g->cv, x-1, y-2, '\'');
    362             cucul_putchar(g->cv, x+2, y-2, '`');
     359            caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_BLACK);
     360            caca_putstr(g->cv, x, y-3, "__");
     361            caca_putchar(g->cv, x-1, y-2, '\'');
     362            caca_putchar(g->cv, x+2, y-2, '`');
    363363            break;
    364364        case 23:
    365             cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK);
    366             cucul_putstr(g->cv, x, y-3, "__");
    367             cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK);
    368             cucul_putstr(g->cv, x-2, y-2, "-'");
    369             cucul_putstr(g->cv, x+2, y-2, "`-");
     365            caca_set_color(g->cv, CACA_COLOR_CYAN, CACA_COLOR_BLACK);
     366            caca_putstr(g->cv, x, y-3, "__");
     367            caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_BLACK);
     368            caca_putstr(g->cv, x-2, y-2, "-'");
     369            caca_putstr(g->cv, x+2, y-2, "`-");
    370370            break;
    371371        case 22:
    372             cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK);
    373             cucul_putstr(g->cv, x, y-3, "__");
    374             cucul_putchar(g->cv, x-1, y-2, '\'');
    375             cucul_putchar(g->cv, x+2, y-2, '`');
    376             cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK);
    377             cucul_putstr(g->cv, x-3, y-2, ",-");
    378             cucul_putstr(g->cv, x+3, y-2, "-.");
     372            caca_set_color(g->cv, CACA_COLOR_CYAN, CACA_COLOR_BLACK);
     373            caca_putstr(g->cv, x, y-3, "__");
     374            caca_putchar(g->cv, x-1, y-2, '\'');
     375            caca_putchar(g->cv, x+2, y-2, '`');
     376            caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_BLACK);
     377            caca_putstr(g->cv, x-3, y-2, ",-");
     378            caca_putstr(g->cv, x+3, y-2, "-.");
    379379            break;
    380380        case 21:
    381             cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK);
    382             cucul_putstr(g->cv, x-1, y-3, "____");
    383             cucul_putchar(g->cv, x-2, y-2, '\'');
    384             cucul_putchar(g->cv, x+3, y-2, '`');
    385             cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK);
    386             cucul_putstr(g->cv, x-4, y-2, ",-");
    387             cucul_putstr(g->cv, x+4, y-2, "-.");
     381            caca_set_color(g->cv, CACA_COLOR_CYAN, CACA_COLOR_BLACK);
     382            caca_putstr(g->cv, x-1, y-3, "____");
     383            caca_putchar(g->cv, x-2, y-2, '\'');
     384            caca_putchar(g->cv, x+3, y-2, '`');
     385            caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_BLACK);
     386            caca_putstr(g->cv, x-4, y-2, ",-");
     387            caca_putstr(g->cv, x+4, y-2, "-.");
    388388            break;
    389389        case 20:
    390             cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK);
    391             cucul_putstr(g->cv, x, y-3, "%%");
    392             cucul_putchar(g->cv, x-4, y-2, ',');
    393             cucul_putchar(g->cv, x+5, y-2, '.');
    394             cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK);
    395             cucul_putchar(g->cv, x-1, y-3, ':');
    396             cucul_putchar(g->cv, x+2, y-3, ':');
    397             cucul_putstr(g->cv, x-3, y-2, "-'");
    398             cucul_putstr(g->cv, x+3, y-2, "`-");
     390            caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_BLACK);
     391            caca_putstr(g->cv, x, y-3, "%%");
     392            caca_putchar(g->cv, x-4, y-2, ',');
     393            caca_putchar(g->cv, x+5, y-2, '.');
     394            caca_set_color(g->cv, CACA_COLOR_CYAN, CACA_COLOR_BLACK);
     395            caca_putchar(g->cv, x-1, y-3, ':');
     396            caca_putchar(g->cv, x+2, y-3, ':');
     397            caca_putstr(g->cv, x-3, y-2, "-'");
     398            caca_putstr(g->cv, x+3, y-2, "`-");
    399399            break;
    400400        case 19:
    401             cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK);
    402             cucul_putstr(g->cv, x, y-4, "%%");
    403             cucul_putstr(g->cv, x, y-3, "##");
    404             cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK);
    405             cucul_putchar(g->cv, x-1, y-4, ':');
    406             cucul_putchar(g->cv, x+2, y-4, ':');
    407             cucul_putchar(g->cv, x-1, y-3, '%');
    408             cucul_putchar(g->cv, x+2, y-3, '%');
    409             cucul_putstr(g->cv, x-4, y-2, ",-'");
    410             cucul_putstr(g->cv, x+3, y-2, "`-.");
    411             cucul_set_color(g->cv, CUCUL_COLOR_BLUE, CUCUL_COLOR_BLACK);
    412             cucul_putchar(g->cv, x-2, y-3, ':');
    413             cucul_putchar(g->cv, x+3, y-3, ':');
     401            caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_BLACK);
     402            caca_putstr(g->cv, x, y-4, "%%");
     403            caca_putstr(g->cv, x, y-3, "##");
     404            caca_set_color(g->cv, CACA_COLOR_CYAN, CACA_COLOR_BLACK);
     405            caca_putchar(g->cv, x-1, y-4, ':');
     406            caca_putchar(g->cv, x+2, y-4, ':');
     407            caca_putchar(g->cv, x-1, y-3, '%');
     408            caca_putchar(g->cv, x+2, y-3, '%');
     409            caca_putstr(g->cv, x-4, y-2, ",-'");
     410            caca_putstr(g->cv, x+3, y-2, "`-.");
     411            caca_set_color(g->cv, CACA_COLOR_BLUE, CACA_COLOR_BLACK);
     412            caca_putchar(g->cv, x-2, y-3, ':');
     413            caca_putchar(g->cv, x+3, y-3, ':');
    414414            break;
    415415        case 18:
    416416        default:
    417417            r = (18 - frame) * (18 - frame);
    418             cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK);
    419             cucul_putstr(g->cv, x-1, y-5-r, ":%%:");
    420             cucul_putstr(g->cv, x-1, y-4-r, "%##%");
    421             cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK);
    422             cucul_putchar(g->cv, x-2, y-4-r, ':');
    423             cucul_putchar(g->cv, x+3, y-4-r, ':');
    424             cucul_putchar(g->cv, x-2, y-2, '\'');
    425             cucul_putchar(g->cv, x+3, y-2, '`');
    426             cucul_set_color(g->cv, CUCUL_COLOR_BLUE, CUCUL_COLOR_BLACK);
    427             cucul_putchar(g->cv, x-3, y-2, ':');
    428             cucul_putchar(g->cv, x+4, y-2, ':');
     418            caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_BLACK);
     419            caca_putstr(g->cv, x-1, y-5-r, ":%%:");
     420            caca_putstr(g->cv, x-1, y-4-r, "%##%");
     421            caca_set_color(g->cv, CACA_COLOR_CYAN, CACA_COLOR_BLACK);
     422            caca_putchar(g->cv, x-2, y-4-r, ':');
     423            caca_putchar(g->cv, x+3, y-4-r, ':');
     424            caca_putchar(g->cv, x-2, y-2, '\'');
     425            caca_putchar(g->cv, x+3, y-2, '`');
     426            caca_set_color(g->cv, CACA_COLOR_BLUE, CACA_COLOR_BLACK);
     427            caca_putchar(g->cv, x-3, y-2, ':');
     428            caca_putchar(g->cv, x+4, y-2, ':');
    429429            for(i = 0; i <= r; i++)
    430430            {
    431                 cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK);
    432                 cucul_putstr(g->cv, x-1, y-3-i, ((i+frame) % 5) ? "####" : "%%%%");
    433                 cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK);
    434                 cucul_putchar(g->cv, x-2, y-3-i, '%');
    435                 cucul_putchar(g->cv, x+3, y-3-i, '%');
    436                 cucul_set_color(g->cv, CUCUL_COLOR_BLUE, CUCUL_COLOR_BLACK);
    437                 cucul_putchar(g->cv, x-3, y-3-i, ':');
    438                 cucul_putchar(g->cv, x+4, y-3-i, ':');
     431                caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_BLACK);
     432                caca_putstr(g->cv, x-1, y-3-i, ((i+frame) % 5) ? "####" : "%%%%");
     433                caca_set_color(g->cv, CACA_COLOR_CYAN, CACA_COLOR_BLACK);
     434                caca_putchar(g->cv, x-2, y-3-i, '%');
     435                caca_putchar(g->cv, x+3, y-3-i, '%');
     436                caca_set_color(g->cv, CACA_COLOR_BLUE, CACA_COLOR_BLACK);
     437                caca_putchar(g->cv, x-3, y-3-i, ':');
     438                caca_putchar(g->cv, x+4, y-3-i, ':');
    439439            }
    440440            break;
     
    447447
    448448    /* Lots of duplicate pixels, but we don't care */
    449     cucul_set_color(g->cv, CUCUL_COLOR_BLUE, CUCUL_COLOR_BLACK);
    450     cucul_draw_ellipse(g->cv, x, y, r, r / 2, ":");
    451     cucul_set_color(g->cv, CUCUL_COLOR_LIGHTBLUE, CUCUL_COLOR_BLUE);
    452     cucul_draw_ellipse(g->cv, x, y, r + 1, r / 2, "#");
    453     cucul_set_color(g->cv, CUCUL_COLOR_BLUE, CUCUL_COLOR_LIGHTBLUE);
    454     cucul_draw_ellipse(g->cv, x, y, r + 2, r / 2, "#");
    455     cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_LIGHTBLUE);
    456     cucul_draw_ellipse(g->cv, x, y, r + 2, r / 2 + 1, "#");
    457     cucul_set_color(g->cv, CUCUL_COLOR_LIGHTBLUE, CUCUL_COLOR_CYAN);
    458     cucul_draw_ellipse(g->cv, x, y, r + 3, r / 2 + 1, "#");
    459     cucul_set_color(g->cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_CYAN);
    460     cucul_draw_ellipse(g->cv, x, y, r + 3, r / 2 + 2, "#");
    461     cucul_set_color(g->cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_WHITE);
    462     cucul_draw_ellipse(g->cv, x, y, r + 4, r / 2 + 2, "#");
    463     cucul_draw_ellipse(g->cv, x, y, r + 4, r / 2 + 3, " ");
    464 }
    465 
     449    caca_set_color(g->cv, CACA_COLOR_BLUE, CACA_COLOR_BLACK);
     450    caca_draw_ellipse(g->cv, x, y, r, r / 2, ":");
     451    caca_set_color(g->cv, CACA_COLOR_LIGHTBLUE, CACA_COLOR_BLUE);
     452    caca_draw_ellipse(g->cv, x, y, r + 1, r / 2, "#");
     453    caca_set_color(g->cv, CACA_COLOR_BLUE, CACA_COLOR_LIGHTBLUE);
     454    caca_draw_ellipse(g->cv, x, y, r + 2, r / 2, "#");
     455    caca_set_color(g->cv, CACA_COLOR_CYAN, CACA_COLOR_LIGHTBLUE);
     456    caca_draw_ellipse(g->cv, x, y, r + 2, r / 2 + 1, "#");
     457    caca_set_color(g->cv, CACA_COLOR_LIGHTBLUE, CACA_COLOR_CYAN);
     458    caca_draw_ellipse(g->cv, x, y, r + 3, r / 2 + 1, "#");
     459    caca_set_color(g->cv, CACA_COLOR_WHITE, CACA_COLOR_CYAN);
     460    caca_draw_ellipse(g->cv, x, y, r + 3, r / 2 + 2, "#");
     461    caca_set_color(g->cv, CACA_COLOR_CYAN, CACA_COLOR_WHITE);
     462    caca_draw_ellipse(g->cv, x, y, r + 4, r / 2 + 2, "#");
     463    caca_draw_ellipse(g->cv, x, y, r + 4, r / 2 + 3, " ");
     464}
     465
Note: See TracChangeset for help on using the changeset viewer.