Ignore:
Timestamp:
Apr 18, 2006, 5:11:25 PM (14 years ago)
Author:
Sam Hocevar
Message:
  • Renamed caca_t into caca_display_t.
  • Renamed canvas handle variables from "c" to "cv". Eh ouais mon gros.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca/driver_conio.c

    r810 r811  
    3939};
    4040
    41 static int conio_init_graphics(caca_t *kk)
     41static int conio_init_graphics(caca_display_t *dp)
    4242{
    43     kk->drv.p = malloc(sizeof(struct driver_private));
     43    dp->drv.p = malloc(sizeof(struct driver_private));
    4444
    4545    _wscroll = 0;
     
    4747    clrscr();
    4848
    49     gettextinfo(&kk->drv.p->ti);
    50     kk->drv.p->screen = malloc(2 * kk->drv.p->ti.screenwidth
    51                                  * kk->drv.p->ti.screenheight * sizeof(char));
    52     if(kk->drv.p->screen == NULL)
     49    gettextinfo(&dp->drv.p->ti);
     50    dp->drv.p->screen = malloc(2 * dp->drv.p->ti.screenwidth
     51                                 * dp->drv.p->ti.screenheight * sizeof(char));
     52    if(dp->drv.p->screen == NULL)
    5353        return -1;
    5454#   if defined(SCREENUPDATE_IN_PC_H)
    55     ScreenRetrieve(kk->drv.p->screen);
     55    ScreenRetrieve(dp->drv.p->screen);
    5656#   else
    5757    /* FIXME */
    5858#   endif
    59     _cucul_set_size(kk->c, kk->drv.p->ti.screenwidth,
    60                            kk->drv.p->ti.screenheight);
     59    _cucul_set_size(dp->cv, dp->drv.p->ti.screenwidth,
     60                            dp->drv.p->ti.screenheight);
    6161    return 0;
    6262}
    6363
    64 static int conio_end_graphics(caca_t *kk)
     64static int conio_end_graphics(caca_display_t *dp)
    6565{
    6666    _wscroll = 1;
    6767    textcolor((enum COLORS)WHITE);
    6868    textbackground((enum COLORS)BLACK);
    69     gotoxy(kk->c->width, kk->c->height);
     69    gotoxy(dp->cv->width, dp->cv->height);
    7070    cputs("\r\n");
    7171    _setcursortype(_NORMALCURSOR);
    7272
    73     free(kk->drv.p->screen);
    74     free(kk->drv.p);
     73    free(dp->drv.p->screen);
     74    free(dp->drv.p);
    7575
    7676    return 0;
    7777}
    7878
    79 static int conio_set_window_title(caca_t *kk, char const *title)
     79static int conio_set_window_title(caca_display_t *dp, char const *title)
    8080{
    8181    return 0;
    8282}
    8383
    84 static unsigned int conio_get_window_width(caca_t *kk)
     84static unsigned int conio_get_window_width(caca_display_t *dp)
    8585{
    8686    /* Fallback to a 6x10 font */
    87     return kk->c->width * 6;
     87    return dp->cv->width * 6;
    8888}
    8989
    90 static unsigned int conio_get_window_height(caca_t *kk)
     90static unsigned int conio_get_window_height(caca_display_t *dp)
    9191{
    9292    /* Fallback to a 6x10 font */
    93     return kk->c->height * 10;
     93    return dp->cv->height * 10;
    9494}
    9595
    96 static void conio_display(caca_t *kk)
     96static void conio_display(caca_display_t *dp)
    9797{
    98     char *screen = kk->drv.p->screen;
    99     uint32_t *attr = kk->c->attr;
    100     uint32_t *chars = kk->c->chars;
     98    char *screen = dp->drv.p->screen;
     99    uint32_t *attr = dp->cv->attr;
     100    uint32_t *chars = dp->cv->chars;
    101101    int n;
    102102
    103     for(n = kk->c->height * kk->c->width; n--; )
     103    for(n = dp->cv->height * dp->cv->width; n--; )
    104104    {
    105105        *screen++ = _cucul_utf32_to_cp437(*chars++);
     
    107107    }
    108108#   if defined(SCREENUPDATE_IN_PC_H)
    109     ScreenUpdate(kk->drv.p->screen);
     109    ScreenUpdate(dp->drv.p->screen);
    110110#   else
    111111    /* FIXME */
     
    113113}
    114114
    115 static void conio_handle_resize(caca_t *kk)
     115static void conio_handle_resize(caca_display_t *dp)
    116116{
    117117    /* We know nothing about our window */
    118     kk->resize.w = kk->c->width;
    119     kk->resize.h = kk->c->height;
     118    dp->resize.w = dp->cv->width;
     119    dp->resize.h = dp->cv->height;
    120120}
    121121
    122 static int conio_get_event(caca_t *kk, caca_event_t *ev)
     122static int conio_get_event(caca_display_t *dp, caca_event_t *ev)
    123123{
    124124    unsigned char ch;
     
    141141    release = *ev;
    142142    release.type = CACA_EVENT_KEY_RELEASE;
    143     _push_event(kk, &release);
     143    _push_event(dp, &release);
    144144
    145145    return 1;
     
    150150 */
    151151
    152 int conio_install(caca_t *kk)
     152int conio_install(caca_display_t *dp)
    153153{
    154     kk->drv.driver = CACA_DRIVER_CONIO;
     154    dp->drv.driver = CACA_DRIVER_CONIO;
    155155
    156     kk->drv.init_graphics = conio_init_graphics;
    157     kk->drv.end_graphics = conio_end_graphics;
    158     kk->drv.set_window_title = conio_set_window_title;
    159     kk->drv.get_window_width = conio_get_window_width;
    160     kk->drv.get_window_height = conio_get_window_height;
    161     kk->drv.display = conio_display;
    162     kk->drv.handle_resize = conio_handle_resize;
    163     kk->drv.get_event = conio_get_event;
    164     kk->drv.set_mouse = NULL;
     156    dp->drv.init_graphics = conio_init_graphics;
     157    dp->drv.end_graphics = conio_end_graphics;
     158    dp->drv.set_window_title = conio_set_window_title;
     159    dp->drv.get_window_width = conio_get_window_width;
     160    dp->drv.get_window_height = conio_get_window_height;
     161    dp->drv.display = conio_display;
     162    dp->drv.handle_resize = conio_handle_resize;
     163    dp->drv.get_event = conio_get_event;
     164    dp->drv.set_mouse = NULL;
    165165
    166166    return 0;
Note: See TracChangeset for help on using the changeset viewer.