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

    r810 r811  
    3030#include "caca_internals.h"
    3131
    32 static int caca_init_driver(caca_t *kk);
     32static int caca_init_driver(caca_display_t *dp);
    3333
    3434/** \brief Attach a caca graphical context to a cucul canvas.
     
    3939 *  then be displayed by the libcaca driver.
    4040 *
    41  *  \param c The cucul cavas.
     41 *  \param cv The cucul cavas.
    4242 *  \return The caca graphical context or NULL if an error occurred.
    4343 */
    44 caca_t * caca_attach(cucul_canvas_t * c)
     44caca_display_t * caca_attach(cucul_canvas_t * cv)
    4545{
    46     caca_t *kk = malloc(sizeof(caca_t));
     46    caca_display_t *dp = malloc(sizeof(caca_display_t));
    4747
    48     kk->c = c;
     48    dp->cv = cv;
    4949
    50     if(caca_init_driver(kk))
     50    if(caca_init_driver(dp))
    5151    {
    52         free(kk);
     52        free(dp);
    5353        return NULL;
    5454    }
    5555
    56     if(kk->drv.init_graphics(kk))
     56    if(dp->drv.init_graphics(dp))
    5757    {
    58         free(kk);
     58        free(dp);
    5959        return NULL;
    6060    }
    6161
    6262    /* Attached! */
    63     kk->c->refcount++;
     63    dp->cv->refcount++;
    6464
    6565    /* Graphics stuff */
    66     kk->delay = 0;
    67     kk->rendertime = 0;
     66    dp->delay = 0;
     67    dp->rendertime = 0;
    6868
    6969    /* Events stuff */
    7070#if defined(USE_SLANG) || defined(USE_NCURSES)
    71     kk->events.key_timer.last_sec = 0;
    72     kk->events.key_timer.last_usec = 0;
    73     kk->events.last_key_ticks = 0;
    74     kk->events.autorepeat_ticks = 0;
    75     kk->events.last_key_event.type = CACA_EVENT_NONE;
     71    dp->events.key_timer.last_sec = 0;
     72    dp->events.key_timer.last_usec = 0;
     73    dp->events.last_key_ticks = 0;
     74    dp->events.autorepeat_ticks = 0;
     75    dp->events.last_key_event.type = CACA_EVENT_NONE;
    7676#endif
    7777#if defined(USE_SLANG) || defined(USE_NCURSES) || defined(USE_CONIO) || defined(USE_GL)
    78     kk->events.queue = 0;
     78    dp->events.queue = 0;
    7979#endif
    8080
    81     kk->timer.last_sec = 0;
    82     kk->timer.last_usec = 0;
    83     kk->lastticks = 0;
     81    dp->timer.last_sec = 0;
     82    dp->timer.last_usec = 0;
     83    dp->lastticks = 0;
    8484
    8585    /* Mouse position */
    86     kk->mouse.x = kk->c->width / 2;
    87     kk->mouse.y = kk->c->height / 2;
     86    dp->mouse.x = dp->cv->width / 2;
     87    dp->mouse.y = dp->cv->height / 2;
    8888
    8989    /* Resize events */
    90     kk->resize.resized = 0;
     90    dp->resize.resized = 0;
    9191
    92     return kk;
     92    return dp;
    9393}
    9494
     
    9999 *  attached to it afterwards.
    100100 *
    101  *  \param kk The libcaca graphical context.
     101 *  \param dp The libcaca graphical context.
    102102 */
    103 void caca_detach(caca_t *kk)
     103void caca_detach(caca_display_t *dp)
    104104{
    105     kk->drv.end_graphics(kk);
    106     kk->c->refcount--;
    107     free(kk);
     105    dp->drv.end_graphics(dp);
     106    dp->cv->refcount--;
     107    free(dp);
    108108}
    109109
     
    112112 */
    113113
    114 static int caca_init_driver(caca_t *kk)
     114static int caca_init_driver(caca_display_t *dp)
    115115{
    116116#if defined(HAVE_GETENV) && defined(HAVE_STRCASECMP)
     
    121121    {
    122122#if defined(USE_WIN32)
    123         if(!strcasecmp(var, "win32")) return win32_install(kk);
     123        if(!strcasecmp(var, "win32")) return win32_install(dp);
    124124#endif
    125125#if defined(USE_CONIO)
    126         if(!strcasecmp(var, "conio")) return conio_install(kk);
     126        if(!strcasecmp(var, "conio")) return conio_install(dp);
    127127#endif
    128128#if defined(USE_X11)
    129         if(!strcasecmp(var, "x11")) return x11_install(kk);
     129        if(!strcasecmp(var, "x11")) return x11_install(dp);
    130130#endif
    131131#if defined(USE_GL)
    132         if(!strcasecmp(var, "gl")) return gl_install(kk);
     132        if(!strcasecmp(var, "gl")) return gl_install(dp);
    133133#endif
    134         if(!strcasecmp(var, "raw")) return raw_install(kk);
     134        if(!strcasecmp(var, "raw")) return raw_install(dp);
    135135#if defined(USE_SLANG)
    136         if(!strcasecmp(var, "slang")) return slang_install(kk);
     136        if(!strcasecmp(var, "slang")) return slang_install(dp);
    137137#endif
    138138#if defined(USE_NCURSES)
    139         if(!strcasecmp(var, "ncurses")) return ncurses_install(kk);
     139        if(!strcasecmp(var, "ncurses")) return ncurses_install(dp);
    140140#endif
    141141#if defined(USE_VGA)
    142         if(!strcasecmp(var, "vga")) return vga_install(kk);
     142        if(!strcasecmp(var, "vga")) return vga_install(dp);
    143143#endif
    144144        return -1;
     
    147147
    148148#if defined(USE_WIN32)
    149     if(win32_install(kk) == 0) return 0;
     149    if(win32_install(dp) == 0) return 0;
    150150#endif
    151151#if defined(USE_CONIO)
    152     if(conio_install(kk) == 0) return 0;
     152    if(conio_install(dp) == 0) return 0;
    153153#endif
    154154#if defined(USE_VGA)
    155     if(vga_install(kk) == 0) return 0;
     155    if(vga_install(dp) == 0) return 0;
    156156#endif
    157157#if defined(USE_X11)
    158     if(x11_install(kk) == 0) return 0;
     158    if(x11_install(dp) == 0) return 0;
    159159#endif
    160160#if defined(USE_GL)
    161     if(gl_install(kk) == 0) return 0;
     161    if(gl_install(dp) == 0) return 0;
    162162#endif
    163163#if defined(USE_SLANG)
    164     if(slang_install(kk) == 0) return 0;
     164    if(slang_install(dp) == 0) return 0;
    165165#endif
    166166#if defined(USE_NCURSES)
    167     if(ncurses_install(kk) == 0) return 0;
     167    if(ncurses_install(dp) == 0) return 0;
    168168#endif
    169169
Note: See TracChangeset for help on using the changeset viewer.