Ignore:
Timestamp:
Nov 16, 2003, 4:20:17 PM (17 years ago)
Author:
Sam Hocevar
Message:
  • src/blit.c: + Added caca_set_dithering() (unused yet). + Added random dithering.
  • src/caca.h: + Renamed legacy EE_* enums to CACA_*.
  • examples/demo.c examples/caca.txt: + Added a default sprite for libcaca.
Location:
libcaca/trunk/examples
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/examples/Makefile.am

    r190 r193  
    44
    55AM_CPPFLAGS = -I$(top_srcdir)/src
     6
     7EXTRA_DIST = caca.txt
    68
    79if USE_SLANG
  • libcaca/trunk/examples/demo.c

    r192 r193  
    6767
    6868    /* Initialize data */
    69     sprite = caca_load_sprite("data/barboss.txt");
     69    sprite = caca_load_sprite("caca.txt");
     70    if(!sprite)
     71        sprite = caca_load_sprite("examples/caca.txt");
    7072
    7173gdk_init (&argc, &argv);
     
    7375    //pixbuf = gdk_pixbuf_new_from_file("/home/sam/pix/badge1.jpeg", NULL);
    7476    //pixbuf = gdk_pixbuf_new_from_file("/home/sam/pix/union.png", NULL);
    75     pixbuf = gdk_pixbuf_new_from_file("/home/sam/pix/pikachu.jpeg", NULL);
     77    //pixbuf = gdk_pixbuf_new_from_file("/home/sam/pix/pikachu.jpeg", NULL);
     78    //pixbuf = gdk_pixbuf_new_from_file("/home/sam/pix/gradient.png", NULL);
     79    //pixbuf = gdk_pixbuf_new_from_file("/home/sam/artwork/aboire.png", NULL);
     80    //pixbuf = gdk_pixbuf_new_from_file("/home/sam/web/sam.zoy.org/artwork/goret.png", NULL);
     81    //pixbuf = gdk_pixbuf_new_from_file("/home/sam/lilkim02.jpg", NULL);
     82    pixbuf = gdk_pixbuf_new_from_file("/home/sam/etw.bmp", NULL);
    7683if(!pixbuf) return -2;
    7784    pixels = gdk_pixbuf_get_pixels(pixbuf);
     
    163170            demo();
    164171
    165             caca_set_color(EE_WHITE);
     172            caca_set_color(CACA_COLOR_WHITE);
    166173            caca_draw_thin_box(1, 1, caca_get_width() - 2, caca_get_height() - 2);
    167174            caca_printf(4, 1, "[%i.%i fps]----",
     
    185192
    186193    caca_clear();
    187     caca_set_color(EE_WHITE);
     194    caca_set_color(CACA_COLOR_WHITE);
    188195    caca_draw_thin_box(1, 1, xo, yo);
    189196
     
    222229
    223230    /* Draw the sun */
    224     caca_set_color(EE_YELLOW);
     231    caca_set_color(CACA_COLOR_YELLOW);
    225232    xo = caca_get_width() / 4;
    226233    yo = caca_get_height() / 4 + 5 * sin(0.03*i);
     
    234241
    235242    j = 15 + sin(0.03*i) * 8;
    236     caca_set_color(EE_WHITE);
     243    caca_set_color(CACA_COLOR_WHITE);
    237244    caca_fill_ellipse(xo, yo, j, j / 2, '#');
    238     caca_set_color(EE_YELLOW);
     245    caca_set_color(CACA_COLOR_YELLOW);
    239246    caca_draw_ellipse(xo, yo, j, j / 2, '#');
    240247
     
    252259    yc = caca_get_height() * 3 / 4 + cos(0.02*i) * 5;
    253260
    254     caca_set_color(EE_GREEN);
     261    caca_set_color(CACA_COLOR_GREEN);
    255262    caca_fill_triangle(xo, yo, xb, yb, xa, ya, '%');
    256     caca_set_color(EE_YELLOW);
     263    caca_set_color(CACA_COLOR_YELLOW);
    257264    caca_draw_thin_triangle(xo, yo, xb, yb, xa, ya);
    258265
    259     caca_set_color(EE_RED);
     266    caca_set_color(CACA_COLOR_RED);
    260267    caca_fill_triangle(xa, ya, xb, yb, xc, yc, '#');
    261     caca_set_color(EE_YELLOW);
     268    caca_set_color(CACA_COLOR_YELLOW);
    262269    caca_draw_thin_triangle(xa, ya, xb, yb, xc, yc);
    263270
    264     caca_set_color(EE_BLUE);
     271    caca_set_color(CACA_COLOR_BLUE);
    265272    caca_fill_triangle(xo, yo, xb, yb, xc, yc, '%');
    266     caca_set_color(EE_YELLOW);
     273    caca_set_color(CACA_COLOR_YELLOW);
    267274    caca_draw_thin_triangle(xo, yo, xb, yb, xc, yc);
    268275
     
    277284    yc = caca_get_height() - 3;
    278285
    279     caca_set_color(EE_CYAN);
     286    caca_set_color(CACA_COLOR_CYAN);
    280287    caca_draw_thin_triangle(xa, ya, xb, yb, xc, yc);
    281288
     
    331338    {
    332339        sprintf(buf, "'%c': %i (%s)", 'a' + i, i, caca_get_color_name(i));
    333         caca_set_color(EE_WHITE);
     340        caca_set_color(CACA_COLOR_WHITE);
    334341        caca_putstr(4, i + 3, buf);
    335342        caca_set_color(i);
     
    458465static void demo_blit(void)
    459466{
    460 caca_set_color(EE_LIGHTGRAY);
    461467    caca_blit(6, 4, caca_get_width() - 6, caca_get_height() - 4, pixels, bufx, bufy);
    462468}
  • libcaca/trunk/examples/spritedit.c

    r192 r193  
    7777        caca_clear();
    7878
    79         caca_set_color(EE_WHITE);
     79        caca_set_color(CACA_COLOR_WHITE);
    8080        caca_draw_thin_box(0, 0, caca_get_width() - 1, caca_get_height() - 1);
    8181
     
    9797        xb = xa + 1 + caca_get_sprite_width(sprite, frame);
    9898        yb = ya + 1 + caca_get_sprite_height(sprite, frame);
    99         caca_set_color(EE_BLACK);
     99        caca_set_color(CACA_COLOR_BLACK);
    100100        caca_fill_box(57 + xa, 10 + ya, 57 + xb, 10 + yb, ' ');
    101         caca_set_color(EE_WHITE);
     101        caca_set_color(CACA_COLOR_WHITE);
    102102        caca_draw_thin_box(57 + xa, 10 + ya, 57 + xb, 10 + yb);
    103103        caca_draw_sprite(57, 10, sprite, frame);
Note: See TracChangeset for help on using the changeset viewer.