Ignore:
Timestamp:
Sep 18, 2006, 6:54:08 PM (14 years ago)
Author:
Sam Hocevar
Message:
  • Bring the tree back in sync with the new libcaca API.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • ttyvaders/trunk/src/intro.c

    r544 r1057  
    3131void intro(game *g)
    3232{
    33     struct cucul_sprite *foo_sprite = cucul_load_sprite(g->qq, "data/foofight.txt");
    34     struct cucul_sprite *bar_sprite = cucul_load_sprite(g->qq, "data/barfight.txt");
    35     struct cucul_sprite *baz_sprite = cucul_load_sprite(g->qq, "data/bazfight.txt");
    36 
     33    caca_event_t ev;
     34    cucul_canvas_t *foo_sprite;
     35    cucul_canvas_t *bar_sprite;
     36    cucul_canvas_t *baz_sprite;
     37    cucul_buffer_t *b;
    3738    int frame = 0;
    3839
    39     while(caca_get_event(g->kk, CACA_EVENT_KEY_PRESS) == 0)
     40    b = cucul_load_file("data/foofight.caca");
     41    foo_sprite = cucul_import_canvas(b, "");
     42    cucul_free_buffer(b);
     43
     44    b = cucul_load_file("data/barfight.caca");
     45    bar_sprite = cucul_import_canvas(b, "");
     46    cucul_free_buffer(b);
     47
     48    b = cucul_load_file("data/bazfight.caca");
     49    baz_sprite = cucul_import_canvas(b, "");
     50    cucul_free_buffer(b);
     51
     52    while(caca_get_event(g->dp, CACA_EVENT_KEY_PRESS, &ev, 0) == 0)
    4053    {
    4154        int i, xo, yo, x[5], y[5];
     
    4356        frame++;
    4457
    45         cucul_clear(g->qq);
     58        cucul_clear_canvas(g->cv);
    4659
    47         xo = cucul_get_width(g->qq) / 2;
    48         yo = cucul_get_height(g->qq) / 2;
     60        xo = cucul_get_canvas_width(g->cv) / 2;
     61        yo = cucul_get_canvas_height(g->cv) / 2;
    4962
    50         cucul_set_color(g->qq, CUCUL_COLOR_RED, CUCUL_COLOR_BLACK);
    51         cucul_fill_ellipse(g->qq, xo, yo, 16, 8, '#');
    52         cucul_set_color(g->qq, CUCUL_COLOR_GREEN, CUCUL_COLOR_BLACK);
    53         cucul_draw_thin_ellipse(g->qq, xo, yo, 16, 8);
     63        cucul_set_color(g->cv, CUCUL_COLOR_RED, CUCUL_COLOR_BLACK);
     64        cucul_fill_ellipse(g->cv, xo, yo, 16, 8, "#");
     65        cucul_set_color(g->cv, CUCUL_COLOR_GREEN, CUCUL_COLOR_BLACK);
     66        cucul_draw_thin_ellipse(g->cv, xo, yo, 16, 8);
    5467
    5568        for(i = 0; i < 4; i ++)
     
    6174        y[4] = y[0];
    6275
    63         cucul_set_color(g->qq, CUCUL_COLOR_BLACK, CUCUL_COLOR_BLACK);
    64         cucul_fill_triangle(g->qq, x[0], y[0], x[1], y[1], x[2], y[2], ' ');
    65         cucul_fill_triangle(g->qq, x[0], y[0], x[3], y[3], x[2], y[2], ' ');
    66         cucul_draw_line(g->qq, x[0], y[0], x[2], y[2], ' ');
    67         cucul_set_color(g->qq, CUCUL_COLOR_GREEN, CUCUL_COLOR_BLACK);
    68         cucul_draw_thin_polyline(g->qq, x, y, 4);
     76        cucul_set_color(g->cv, CUCUL_COLOR_BLACK, CUCUL_COLOR_BLACK);
     77        cucul_fill_triangle(g->cv, x[0], y[0], x[1], y[1], x[2], y[2], " ");
     78        cucul_fill_triangle(g->cv, x[0], y[0], x[3], y[3], x[2], y[2], " ");
     79        cucul_draw_line(g->cv, x[0], y[0], x[2], y[2], " ");
     80        cucul_set_color(g->cv, CUCUL_COLOR_GREEN, CUCUL_COLOR_BLACK);
     81        cucul_draw_thin_polyline(g->cv, x, y, 4);
    6982
    70         cucul_draw_sprite(g->qq, xo, yo, foo_sprite, frame % 5);
     83        cucul_set_canvas_frame(foo_sprite, frame % 5);
     84        cucul_blit(g->cv, xo, yo, foo_sprite, NULL);
    7185
    72         caca_display(g->kk);
     86        caca_refresh_display(g->dp);
    7387
    7488        usleep(40000);
Note: See TracChangeset for help on using the changeset viewer.