Ignore:
Timestamp:
Mar 8, 2006, 11:33:01 AM (14 years ago)
Author:
Sam Hocevar
Message:
  • Finished moving everything driver-specific to the apropriate driver_*.c files. Phew. Now they just need a few comments.
File:
1 edited

Legend:

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

    r549 r550  
    2828#endif
    2929
     30#include <stdlib.h>
     31
    3032#include "caca.h"
    3133#include "caca_internals.h"
     
    3335#include "cucul_internals.h"
    3436
     37struct driver_private
     38{
     39    struct text_info ti;
     40    char *screen;
     41};
     42
    3543static int conio_init_graphics(caca_t *kk)
    3644{
     45    kk->drv.p = malloc(sizeof(struct driver_private));
     46
    3747    _wscroll = 0;
    3848    _setcursortype(_NOCURSOR);
    3949    clrscr();
    4050
    41     gettextinfo(&kk->conio.ti);
    42     kk->conio.screen = malloc(2 * kk->conio.ti.screenwidth
    43                                 * kk->conio.ti.screenheight * sizeof(char));
    44     if(kk->conio.screen == NULL)
     51    gettextinfo(&kk->drv.p->ti);
     52    kk->drv.p->screen = malloc(2 * kk->drv.p->ti.screenwidth
     53                                 * kk->drv.p->ti.screenheight * sizeof(char));
     54    if(kk->drv.p->screen == NULL)
    4555        return -1;
    4656#   if defined(SCREENUPDATE_IN_PC_H)
    47     ScreenRetrieve(kk->conio.screen);
     57    ScreenRetrieve(kk->drv.p->screen);
    4858#   else
    4959    /* FIXME */
    5060#   endif
    51     cucul_set_size(kk->qq, kk->conio.ti.screenwidth,
    52                            kk->conio.ti.screenheight);
     61    cucul_set_size(kk->qq, kk->drv.p->ti.screenwidth,
     62                           kk->drv.p->ti.screenheight);
    5363    return 0;
    5464}
     
    6373    _setcursortype(_NORMALCURSOR);
    6474
    65     free(kk->conio.screen);
     75    free(kk->drv.p->screen);
     76    free(kk->drv.p);
    6677
    6778    return 0;
     
    8899{
    89100    int n;
    90     char *screen = kk->conio.screen;
     101    char *screen = kk->drv.p->screen;
    91102    uint8_t *attr = kk->qq->attr;
    92103    uint32_t *chars = kk->qq->chars;
     
    97108    }
    98109#   if defined(SCREENUPDATE_IN_PC_H)
    99     ScreenUpdate(kk->conio.screen);
     110    ScreenUpdate(kk->drv.p->screen);
    100111#   else
    101112    /* FIXME */
     
    128139void conio_init_driver(caca_t *kk)
    129140{
    130     kk->driver.driver = CACA_DRIVER_CONIO;
     141    kk->drv.driver = CACA_DRIVER_CONIO;
    131142
    132     kk->driver.init_graphics = conio_init_graphics;
    133     kk->driver.end_graphics = conio_end_graphics;
    134     kk->driver.set_window_title = conio_set_window_title;
    135     kk->driver.get_window_width = conio_get_window_width;
    136     kk->driver.get_window_height = conio_get_window_height;
    137     kk->driver.display = conio_display;
    138     kk->driver.handle_resize = conio_handle_resize;
    139     kk->driver.get_event = conio_get_event;
     143    kk->drv.init_graphics = conio_init_graphics;
     144    kk->drv.end_graphics = conio_end_graphics;
     145    kk->drv.set_window_title = conio_set_window_title;
     146    kk->drv.get_window_width = conio_get_window_width;
     147    kk->drv.get_window_height = conio_get_window_height;
     148    kk->drv.display = conio_display;
     149    kk->drv.handle_resize = conio_handle_resize;
     150    kk->drv.get_event = conio_get_event;
    140151}
    141152
Note: See TracChangeset for help on using the changeset viewer.