Ignore:
Timestamp:
Sep 27, 2008, 3:12:46 PM (11 years ago)
Author:
Sam Hocevar
Message:

Starting refactoring to get rid of libcucul. The initial reason for the
split is rendered moot by the plugin system: when enabled, binaries do
not link directly with libX11 or libGL. I hope this is a step towards
more consisteny and clarity.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/examples/text.c

    r2305 r2821  
    2121#endif
    2222
    23 #include "cucul.h"
     23#include "caca.h"
    2424
    2525#define STRING \
     
    3636int main(int argc, char *argv[])
    3737{
    38     cucul_canvas_t *cv, *pig;
     38    caca_canvas_t *cv, *pig;
    3939    void *buffer;
    4040    size_t len;
    4141    int i, j;
    4242
    43     pig = cucul_create_canvas(0, 0);
    44     cucul_import_memory(pig, STRING, strlen(STRING), "text");
     43    pig = caca_create_canvas(0, 0);
     44    caca_import_memory(pig, STRING, strlen(STRING), "text");
    4545
    46     cv = cucul_create_canvas(cucul_get_canvas_width(pig) * 2,
    47                              cucul_get_canvas_height(pig) * 2);
     46    cv = caca_create_canvas(caca_get_canvas_width(pig) * 2,
     47                             caca_get_canvas_height(pig) * 2);
    4848
    4949    if(cv == NULL || pig == NULL)
     
    5353    }
    5454
    55     cucul_blit(cv, 0, 0, pig, NULL);
    56     cucul_flip(pig);
    57     cucul_blit(cv, cucul_get_canvas_width(pig), 0, pig, NULL);
    58     cucul_flip(pig);
    59     cucul_flop(pig);
    60     cucul_blit(cv, 0, cucul_get_canvas_height(pig), pig, NULL);
    61     cucul_flop(pig);
    62     cucul_rotate_180(pig);
    63     cucul_blit(cv, cucul_get_canvas_width(pig),
    64                    cucul_get_canvas_height(pig), pig, NULL);
     55    caca_blit(cv, 0, 0, pig, NULL);
     56    caca_flip(pig);
     57    caca_blit(cv, caca_get_canvas_width(pig), 0, pig, NULL);
     58    caca_flip(pig);
     59    caca_flop(pig);
     60    caca_blit(cv, 0, caca_get_canvas_height(pig), pig, NULL);
     61    caca_flop(pig);
     62    caca_rotate_180(pig);
     63    caca_blit(cv, caca_get_canvas_width(pig),
     64                   caca_get_canvas_height(pig), pig, NULL);
    6565
    66     for(j = 0; j < cucul_get_canvas_height(cv); j++)
     66    for(j = 0; j < caca_get_canvas_height(cv); j++)
    6767    {
    68         for(i = 0; i < cucul_get_canvas_width(cv); i += 2)
     68        for(i = 0; i < caca_get_canvas_width(cv); i += 2)
    6969        {
    7070            unsigned long int a;
    71             cucul_set_color_ansi(cv, CUCUL_LIGHTBLUE + (i + j) % 6,
    72                                  CUCUL_DEFAULT);
    73             a = cucul_get_attr(cv, -1, -1);
    74             cucul_put_attr(cv, i, j, a);
    75             cucul_put_attr(cv, i + 1, j, a);
     71            caca_set_color_ansi(cv, CACA_LIGHTBLUE + (i + j) % 6,
     72                                 CACA_DEFAULT);
     73            a = caca_get_attr(cv, -1, -1);
     74            caca_put_attr(cv, i, j, a);
     75            caca_put_attr(cv, i + 1, j, a);
    7676        }
    7777    }
    7878
    79     buffer = cucul_export_memory(cv, "utf8", &len);
     79    buffer = caca_export_memory(cv, "utf8", &len);
    8080    fwrite(buffer, len, 1, stdout);
    8181    free(buffer);
    8282
    83     cucul_rotate_left(cv);
    84     buffer = cucul_export_memory(cv, "utf8", &len);
     83    caca_rotate_left(cv);
     84    buffer = caca_export_memory(cv, "utf8", &len);
    8585    fwrite(buffer, len, 1, stdout);
    8686    free(buffer);
    8787
    88     cucul_free_canvas(pig);
    89     cucul_free_canvas(cv);
     88    caca_free_canvas(pig);
     89    caca_free_canvas(cv);
    9090
    9191    return 0;
Note: See TracChangeset for help on using the changeset viewer.