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

    r810 r811  
    2828 *  the X11 and Win32 drivers.
    2929 *
    30  *  \param kk The libcaca graphical context.
     30 *  \param dp The libcaca graphical context.
    3131 *  \param title The desired window title.
    3232 *  \return 0 upon success, a non-zero value if an error occurs.
    3333 */
    34 int caca_set_window_title(caca_t *kk, char const *title)
     34int caca_set_window_title(caca_display_t *dp, char const *title)
    3535{
    36     return kk->drv.set_window_title(kk, title);
     36    return dp->drv.set_window_title(dp, title);
    3737}
    3838
     
    4444 *  6x10 font is being used. Note that the units are not necessarily pixels.
    4545 *
    46  *  \param kk The libcaca graphical context.
     46 *  \param dp The libcaca graphical context.
    4747 *  \return The window width.
    4848 */
    49 unsigned int caca_get_window_width(caca_t *kk)
     49unsigned int caca_get_window_width(caca_display_t *dp)
    5050{
    51     return kk->drv.get_window_width(kk);
     51    return dp->drv.get_window_width(dp);
    5252}
    5353
     
    5959 *  used. Note that the units are not necessarily pixels.
    6060 *
    61  *  \param kk The libcaca graphical context.
     61 *  \param dp The libcaca graphical context.
    6262 *  \return The window height.
    6363 */
    64 unsigned int caca_get_window_height(caca_t *kk)
     64unsigned int caca_get_window_height(caca_display_t *dp)
    6565{
    66     return kk->drv.get_window_height(kk);
     66    return dp->drv.get_window_height(dp);
    6767}
    6868
     
    7676 *  default behaviour.
    7777 *
    78  *  \param kk The libcaca graphical context.
     78 *  \param dp The libcaca graphical context.
    7979 *  \param usec The refresh delay in microseconds.
    8080 */
    81 void caca_set_delay(caca_t *kk, unsigned int usec)
     81void caca_set_delay(caca_display_t *dp, unsigned int usec)
    8282{
    83     kk->delay = usec;
     83    dp->delay = usec;
    8484}
    8585
     
    9292 *  even if the real rendering time was shorter.
    9393 *
    94  *  \param kk The libcaca graphical context.
     94 *  \param dp The libcaca graphical context.
    9595 *  \return The render time in microseconds.
    9696 */
    97 unsigned int caca_get_rendertime(caca_t *kk)
     97unsigned int caca_get_rendertime(caca_display_t *dp)
    9898{
    99     return kk->rendertime;
     99    return dp->rendertime;
    100100}
    101101
     
    112112 *  performing the screen refresh.
    113113 *
    114  *  \param kk The libcaca graphical context.
     114 *  \param dp The libcaca graphical context.
    115115 */
    116 void caca_display(caca_t *kk)
     116void caca_display(caca_display_t *dp)
    117117{
    118118#if !defined(_DOXYGEN_SKIP_ME)
    119119#define IDLE_USEC 10000
    120120#endif
    121     int ticks = kk->lastticks + _caca_getticks(&kk->timer);
     121    int ticks = dp->lastticks + _caca_getticks(&dp->timer);
    122122
    123     kk->drv.display(kk);
     123    dp->drv.display(dp);
    124124
    125125    /* Once the display is finished, we can ack resizes */
    126     if(kk->resize.resized)
     126    if(dp->resize.resized)
    127127    {
    128         kk->resize.resized = 0;
    129         _caca_handle_resize(kk);
     128        dp->resize.resized = 0;
     129        _caca_handle_resize(dp);
    130130    }
    131131
    132     /* Wait until kk->delay + time of last call */
    133     ticks += _caca_getticks(&kk->timer);
    134     for(ticks += _caca_getticks(&kk->timer);
    135         ticks + IDLE_USEC < (int)kk->delay;
    136         ticks += _caca_getticks(&kk->timer))
     132    /* Wait until dp->delay + time of last call */
     133    ticks += _caca_getticks(&dp->timer);
     134    for(ticks += _caca_getticks(&dp->timer);
     135        ticks + IDLE_USEC < (int)dp->delay;
     136        ticks += _caca_getticks(&dp->timer))
    137137    {
    138138        _caca_sleep(IDLE_USEC);
     
    140140
    141141    /* Update the sliding mean of the render time */
    142     kk->rendertime = (7 * kk->rendertime + ticks) / 8;
     142    dp->rendertime = (7 * dp->rendertime + ticks) / 8;
    143143
    144     kk->lastticks = ticks - kk->delay;
     144    dp->lastticks = ticks - dp->delay;
    145145
    146146    /* If we drifted too much, it's bad, bad, bad. */
    147     if(kk->lastticks > (int)kk->delay)
    148         kk->lastticks = 0;
     147    if(dp->lastticks > (int)dp->delay)
     148        dp->lastticks = 0;
    149149}
    150150
     
    154154 *  support it.
    155155 *
    156  *  \param kk The libcaca graphical context.
     156 *  \param dp The libcaca graphical context.
    157157 *  \param flag 0 hides the pointer, 1 shows the system's default pointer
    158158 *              (usually an arrow). Other values are reserved for future use.
    159159 */
    160 void caca_set_mouse(caca_t *kk, int flag)
     160void caca_set_mouse(caca_display_t *dp, int flag)
    161161{
    162     if(kk->drv.set_mouse)
    163         kk->drv.set_mouse(kk, flag);
     162    if(dp->drv.set_mouse)
     163        dp->drv.set_mouse(dp, flag);
    164164}
    165165
     
    168168 */
    169169
    170 void _caca_handle_resize(caca_t *kk)
     170void _caca_handle_resize(caca_display_t *dp)
    171171{
    172     kk->drv.handle_resize(kk);
     172    dp->drv.handle_resize(dp);
    173173
    174174    /* Tell libcucul we changed size */
    175     if(kk->resize.w != kk->c->width || kk->resize.h != kk->c->height)
    176         _cucul_set_size(kk->c, kk->resize.w, kk->resize.h);
     175    if(dp->resize.w != dp->cv->width || dp->resize.h != dp->cv->height)
     176        _cucul_set_size(dp->cv, dp->resize.w, dp->resize.h);
    177177}
    178178
Note: See TracChangeset for help on using the changeset viewer.