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/cacamoir.c

    r522 r524  
    1717#include <string.h>
    1818
     19#include "cucul.h"
    1920#include "caca.h"
    2021
     
    3536int main (int argc, char **argv)
    3637{
     38    cucul_t *qq; caca_t *kk;
    3739    unsigned int red[256], green[256], blue[256], alpha[256];
    38     struct caca_bitmap *bitmap;
     40    struct cucul_bitmap *bitmap;
    3941    int i, x, y, frame = 0, pause = 0;
    4042
    41     if(caca_init() < 0)
     43    qq = cucul_init();
     44    if(!qq)
     45        return 1;
     46    kk = caca_attach(qq);
     47    if(!kk)
    4248        return 1;
    4349
    44     caca_set_delay(20000);
     50    caca_set_delay(kk, 20000);
    4551
    4652    /* Fill various tables */
     
    5561        draw_disc(i, (i / DISCTHICKNESS) % 2);
    5662
    57     /* Create a libcaca bitmap */
    58     bitmap = caca_create_bitmap(8, XSIZ, YSIZ, XSIZ, 0, 0, 0, 0);
     63    /* Create a libcucul bitmap */
     64    bitmap = cucul_create_bitmap(qq, 8, XSIZ, YSIZ, XSIZ, 0, 0, 0, 0);
    5965
    6066    /* Main loop */
    6167    for(;;)
    6268    {
    63         switch(caca_get_event(CACA_EVENT_KEY_PRESS))
     69        switch(caca_get_event(kk, CACA_EVENT_KEY_PRESS))
    6470        {
    6571            case CACA_EVENT_KEY_PRESS | CACA_KEY_ESCAPE: goto end;
     
    8187        blue[1] = 0.5 * (1 + cos(0.05 * frame + 5.0)) * 0xfff;
    8288
    83         caca_set_bitmap_palette(bitmap, red, green, blue, alpha);
     89        cucul_set_bitmap_palette(qq, bitmap, red, green, blue, alpha);
    8490
    8591        /* Draw circles */
     
    95101
    96102paused:
    97         caca_draw_bitmap(0, 0, caca_get_width() - 1, caca_get_height() - 1,
    98                          bitmap, screen);
    99         caca_refresh();
     103        cucul_draw_bitmap(qq, 0, 0,
     104                          cucul_get_width(qq) - 1, cucul_get_height(qq) - 1,
     105                          bitmap, screen);
     106        caca_refresh(kk);
    100107    }
    101108
    102109end:
    103     caca_free_bitmap(bitmap);
    104     caca_end();
     110    cucul_free_bitmap(qq, bitmap);
     111    caca_detach(kk);
     112    cucul_end(qq);
    105113
    106114    return 0;
Note: See TracChangeset for help on using the changeset viewer.