Ignore:
Timestamp:
Apr 28, 2009, 6:55:01 PM (11 years ago)
Author:
Sam Hocevar
Message:
  • Toying around with the old ttyvaders version.
Location:
ttyvaders/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ttyvaders/trunk

    • Property svn:ignore
      •  

        old new  
        1313*-stamp
        1414INSTALL
         15*.ncb
         16*.suo
         17*.vcproj.*.user
  • ttyvaders/trunk/src/intro.c

    r2990 r3423  
    1717#include <stdlib.h>
    1818#include <math.h>
    19 #include <unistd.h>
     19#ifndef M_PI
     20#   define M_PI 3.14159265358979323846
     21#endif
     22//#include <unistd.h>
    2023
    2124#include "common.h"
     
    2730    caca_canvas_t *bar_sprite;
    2831    caca_canvas_t *baz_sprite;
    29     caca_buffer_t *b;
    3032    int frame = 0;
    3133
    32     b = caca_load_file("data/foofight.caca");
    33     foo_sprite = caca_import_canvas(b, "");
    34     caca_free_buffer(b);
     34    foo_sprite = caca_create_canvas(0, 0);
     35    caca_import_file(foo_sprite, "data/foofight.txt", "utf8");
    3536
    36     b = caca_load_file("data/barfight.caca");
    37     bar_sprite = caca_import_canvas(b, "");
    38     caca_free_buffer(b);
     37    bar_sprite = caca_create_canvas(0, 0);
     38    caca_import_file(bar_sprite, "data/barfight.txt", "utf8");
    3939
    40     b = caca_load_file("data/bazfight.caca");
    41     baz_sprite = caca_import_canvas(b, "");
    42     caca_free_buffer(b);
     40    baz_sprite = caca_create_canvas(0, 0);
     41    caca_import_file(baz_sprite, "data/bazfight.txt", "utf8");
    4342
    4443    while(caca_get_event(g->dp, CACA_EVENT_KEY_PRESS, &ev, 0) == 0)
     
    5352        yo = caca_get_canvas_height(g->cv) / 2;
    5453
    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);
     54        caca_set_color_ansi(g->cv, CACA_RED, CACA_BLACK);
     55        caca_fill_ellipse(g->cv, xo, yo, 16, 8, '#');
     56        caca_set_color_ansi(g->cv, CACA_GREEN, CACA_BLACK);
    5857        caca_draw_thin_ellipse(g->cv, xo, yo, 16, 8);
    5958
     
    6665        y[4] = y[0];
    6766
    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);
     67        caca_set_color_ansi(g->cv, CACA_BLACK, CACA_BLACK);
     68        caca_fill_triangle(g->cv, x[0], y[0], x[1], y[1], x[2], y[2], ' ');
     69        caca_fill_triangle(g->cv, x[0], y[0], x[3], y[3], x[2], y[2], ' ');
     70        caca_draw_line(g->cv, x[0], y[0], x[2], y[2], ' ');
     71        caca_set_color_ansi(g->cv, CACA_GREEN, CACA_BLACK);
    7372        caca_draw_thin_polyline(g->cv, x, y, 4);
    7473
    75         caca_set_canvas_frame(foo_sprite, frame % 5);
     74        caca_set_frame(foo_sprite, frame % 5);
    7675        caca_blit(g->cv, xo, yo, foo_sprite, NULL);
    7776
    7877        caca_refresh_display(g->dp);
    7978
    80         usleep(40000);
     79        //usleep(40000);
    8180    }
    8281}
Note: See TracChangeset for help on using the changeset viewer.