Ignore:
Timestamp:
Sep 27, 2008, 3:12:46 PM (12 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/event.c

    r2299 r2821  
    2121#endif
    2222
    23 #include "cucul.h"
    2423#include "caca.h"
    2524
    26 static cucul_canvas_t *cv;
     25static caca_canvas_t *cv;
    2726static caca_display_t *dp;
    2827
     
    3433    int i, h, quit;
    3534
    36     cv = cucul_create_canvas(80, 24);
     35    cv = caca_create_canvas(80, 24);
    3736    if(cv == NULL)
    3837    {
     
    4847    }
    4948
    50     h = cucul_get_canvas_height(cv) - 1;
     49    h = caca_get_canvas_height(cv) - 1;
    5150
    52     cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE);
    53     cucul_draw_line(cv, 0, 0, cucul_get_canvas_width(cv) - 1, 0, ' ');
     51    caca_set_color_ansi(cv, CACA_WHITE, CACA_BLUE);
     52    caca_draw_line(cv, 0, 0, caca_get_canvas_width(cv) - 1, 0, ' ');
    5453
    55     cucul_draw_line(cv, 0, h, cucul_get_canvas_width(cv) - 1, h, ' ');
    56     cucul_put_str(cv, 0, h, "type \"quit\" to exit");
     54    caca_draw_line(cv, 0, h, caca_get_canvas_width(cv) - 1, h, ' ');
     55    caca_put_str(cv, 0, h, "type \"quit\" to exit");
    5756
    5857    caca_refresh_display(dp);
     
    9291        while(ret);
    9392
    94         cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK);
    95         cucul_clear_canvas(cv);
     93        caca_set_color_ansi(cv, CACA_LIGHTGRAY, CACA_BLACK);
     94        caca_clear_canvas(cv);
    9695
    9796        /* Print current event */
    98         cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE);
    99         cucul_draw_line(cv, 0, 0, cucul_get_canvas_width(cv) - 1, 0, ' ');
     97        caca_set_color_ansi(cv, CACA_WHITE, CACA_BLUE);
     98        caca_draw_line(cv, 0, 0, caca_get_canvas_width(cv) - 1, 0, ' ');
    10099        print_event(0, 0, events);
    101100
    102         cucul_draw_line(cv, 0, h, cucul_get_canvas_width(cv) - 1, h, ' ');
    103         cucul_printf(cv, 0, h, "type \"quit\" to exit: %s", quit_string[quit]);
     101        caca_draw_line(cv, 0, h, caca_get_canvas_width(cv) - 1, h, ' ');
     102        caca_printf(cv, 0, h, "type \"quit\" to exit: %s", quit_string[quit]);
    104103
    105104        /* Print previous events */
    106         cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLACK);
     105        caca_set_color_ansi(cv, CACA_WHITE, CACA_BLACK);
    107106        for(i = 1; i < h && caca_get_event_type(&events[i]); i++)
    108107            print_event(0, i, events + i);
     
    114113    free(events);
    115114    caca_free_display(dp);
    116     cucul_free_canvas(cv);
     115    caca_free_canvas(cv);
    117116
    118117    return 0;
     
    126125    {
    127126    case CACA_EVENT_NONE:
    128         cucul_printf(cv, x, y, "CACA_EVENT_NONE");
     127        caca_printf(cv, x, y, "CACA_EVENT_NONE");
    129128        break;
    130129    case CACA_EVENT_KEY_PRESS:
    131130        character = caca_get_event_key_ch(ev);
    132         cucul_printf(cv, x, y, "CACA_EVENT_KEY_PRESS 0x%02x (%c)", character,
     131        caca_printf(cv, x, y, "CACA_EVENT_KEY_PRESS 0x%02x (%c)", character,
    133132                     (character > 0x1f && character < 0x80) ? character : '?');
    134133        break;
    135134    case CACA_EVENT_KEY_RELEASE:
    136135        character = caca_get_event_key_ch(ev);
    137         cucul_printf(cv, x, y, "CACA_EVENT_KEY_RELEASE 0x%02x (%c)", character,
     136        caca_printf(cv, x, y, "CACA_EVENT_KEY_RELEASE 0x%02x (%c)", character,
    138137                     (character > 0x1f && character < 0x80) ? character : '?');
    139138        break;
    140139    case CACA_EVENT_MOUSE_MOTION:
    141         cucul_printf(cv, x, y, "CACA_EVENT_MOUSE_MOTION %u %u",
     140        caca_printf(cv, x, y, "CACA_EVENT_MOUSE_MOTION %u %u",
    142141                     caca_get_event_mouse_x(ev), caca_get_event_mouse_y(ev));
    143142        break;
    144143    case CACA_EVENT_MOUSE_PRESS:
    145         cucul_printf(cv, x, y, "CACA_EVENT_MOUSE_PRESS %u",
     144        caca_printf(cv, x, y, "CACA_EVENT_MOUSE_PRESS %u",
    146145                     caca_get_event_mouse_button(ev));
    147146        break;
    148147    case CACA_EVENT_MOUSE_RELEASE:
    149         cucul_printf(cv, x, y, "CACA_EVENT_MOUSE_RELEASE %u",
     148        caca_printf(cv, x, y, "CACA_EVENT_MOUSE_RELEASE %u",
    150149                     caca_get_event_mouse_button(ev));
    151150        break;
    152151    case CACA_EVENT_RESIZE:
    153         cucul_printf(cv, x, y, "CACA_EVENT_RESIZE %u %u",
     152        caca_printf(cv, x, y, "CACA_EVENT_RESIZE %u %u",
    154153                     caca_get_event_resize_width(ev),
    155154                     caca_get_event_resize_height(ev));
    156155        break;
    157156    case CACA_EVENT_QUIT:
    158         cucul_printf(cv, x, y, "CACA_EVENT_QUIT");
     157        caca_printf(cv, x, y, "CACA_EVENT_QUIT");
    159158        break;
    160159    default:
    161         cucul_printf(cv, x, y, "CACA_EVENT_UNKNOWN");
     160        caca_printf(cv, x, y, "CACA_EVENT_UNKNOWN");
    162161    }
    163162}
Note: See TracChangeset for help on using the changeset viewer.