Ignore:
Timestamp:
Mar 5, 2006, 7:43:13 PM (17 years ago)
Author:
Sam Hocevar
Message:

A new low-level text management library (canvas for ultrafast compositing

of unicode letters) is now separated from the higher level rendering and I/O
(that is, libcaca). This commit totally breaks the API, but once everything
is polished I will think about source-level backward compatibility. Most
drivers are broken, but X11 still sorta works.

The new design is much more object-oriented and allows having several

active renderers at the same time, changing renderers on the fly, and more
important, having no renderer at all (useful for converters, or when you
want to do your own renderer).

And in case you are still wondering, the libcucul acronym has "Unicode"

because I want to support at least a subset of Unicode. There are awesome
glyphs in it, including the ones inherited from Codepage 437 such as
"gray 25%" that are used in DOS and Win32 ANSI art.

Location:
libcaca/trunk/examples
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/examples

    • Property svn:ignore
      •  

        old new  
        33.libs
        44.deps
        5 cacademo
        6 cacademo.exe
        75caca-spritedit
        86caca-spritedit.exe
  • libcaca/trunk/examples/aafire.c

    r514 r524  
    3838#define MAXTABLE (256*5)
    3939#ifdef LIBCACA
     40static cucul_t *qq;
     41static caca_t *kk;
    4042static int XSIZ, YSIZ;
    41 static struct caca_bitmap *caca_bitmap;
     43static struct cucul_bitmap *cucul_bitmap;
    4244static char *bitmap;
    4345static int pause = 0;
     
    9799
    98100#ifdef LIBCACA
    99   if (caca_init())
     101  qq = cucul_init();
     102  if (!qq)
     103    {
     104      printf ("Failed to initialize libcucul\n");
     105      exit (1);
     106    }
     107  kk = caca_attach(qq);
     108  if (!kk)
    100109    {
    101110      printf ("Failed to initialize libcaca\n");
    102111      exit (1);
    103112    }
    104   caca_set_delay(10000);
    105   XSIZ = caca_get_width() * 2;
    106   YSIZ = caca_get_height() * 2 - 4;
     113  caca_set_delay(kk, 10000);
     114  XSIZ = cucul_get_width(qq) * 2;
     115  YSIZ = cucul_get_height(qq) * 2 - 4;
    107116#else
    108117  context = aa_autoinit (&aa_defparams);
     
    130139
    131140#ifdef LIBCACA
    132   caca_bitmap = caca_create_bitmap(8, XSIZ, YSIZ - 2, XSIZ, 0, 0, 0, 0);
    133   caca_set_bitmap_palette(caca_bitmap, r, g, b, a);
    134   bitmap = malloc(4 * caca_get_width() * caca_get_height() * sizeof(char));
    135   memset(bitmap, 0, 4 * caca_get_width() * caca_get_height());
     141  cucul_bitmap = cucul_create_bitmap(qq, 8, XSIZ, YSIZ - 2, XSIZ, 0, 0, 0, 0);
     142  cucul_set_bitmap_palette(qq, cucul_bitmap, r, g, b, a);
     143  bitmap = malloc(4 * cucul_get_width(qq) * cucul_get_height(qq) * sizeof(char));
     144  memset(bitmap, 0, 4 * cucul_get_width(qq) * cucul_get_height(qq));
    136145#else
    137146  aa_hidecursor (context);
     
    142151{
    143152#ifdef LIBCACA
    144   caca_end();
     153  caca_detach(kk);
     154  cucul_end(qq);
    145155#else
    146156  aa_close (context);
     
    224234#ifdef LIBCACA
    225235paused:
    226   caca_draw_bitmap(0, 0, caca_get_width() - 1, caca_get_height() - 1,
    227                    caca_bitmap, bitmap);
    228   caca_refresh();
     236  cucul_draw_bitmap(qq, 0, 0,
     237                    cucul_get_width(qq) - 1, cucul_get_height(qq) - 1,
     238                    cucul_bitmap, bitmap);
     239  caca_refresh(kk);
    229240  /*XSIZ = caca_get_width() * 2;
    230241  YSIZ = caca_get_height() * 2 - 4;*/
     
    249260    {
    250261#ifdef LIBCACA
    251       switch (caca_get_event(CACA_EVENT_KEY_PRESS))
     262      switch (caca_get_event(kk, CACA_EVENT_KEY_PRESS))
    252263        {
    253264          case CACA_EVENT_KEY_PRESS | CACA_KEY_ESCAPE: return;
Note: See TracChangeset for help on using the changeset viewer.