Ignore:
Timestamp:
Mar 7, 2006, 10:17:35 AM (14 years ago)
Author:
Sam Hocevar
Message:
  • Polished the driver split a bit (still no events, except resize events), properly credited authors and documented a few things.
File:
1 edited

Legend:

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

    r539 r540  
    1010 */
    1111
    12 /** \file graphics.c
     12/** \file driver_win32.c
    1313 *  \version \$Id$
    1414 *  \author Sam Hocevar <sam@zoy.org>
    15  *  \brief Character drawing
     15 *  \brief Win32 driver
    1616 *
    17  *  This file contains character and string drawing functions.
     17 *  This file contains the libcaca Win32 input and output driver
    1818 */
    1919
    2020#include "config.h"
    21 
    22 #if defined(HAVE_INTTYPES_H) || defined(_DOXYGEN_SKIP_ME)
    23 #   include <inttypes.h>
    24 #else
    25 typedef unsigned int uint32_t;
    26 typedef unsigned char uint8_t;
    27 #endif
    2821
    2922#if defined(USE_WIN32)
     
    8881};
    8982
    90 int win32_init_graphics(caca_t *);
    91 int win32_end_graphics(caca_t *);
    92 int win32_set_window_title(caca_t *, char const *);
    93 unsigned int win32_get_window_width(caca_t *);
    94 unsigned int win32_get_window_height(caca_t *);
    95 void win32_display(caca_t *);
    96 void win32_handle_resize(caca_t *);
    97 
    98 int win32_init_graphics(caca_t *kk)
    99 {
    100     CONSOLE_CURSOR_INFO cci;
     83static int win32_init_graphics(caca_t *kk)
     84{
    10185    CONSOLE_SCREEN_BUFFER_INFO csbi;
    10286    COORD size;
     
    11296        return -1;
    11397
    114     GetConsoleCursorInfo(kk->win32.hout, &cci);
    115     cci.bVisible = FALSE;
    116     SetConsoleCursorInfo(kk->win32.hout, &cci);
     98    GetConsoleCursorInfo(kk->win32.hout, &kk->win32.cci);
     99    kk->win32.cci.bVisible = FALSE;
     100    SetConsoleCursorInfo(kk->win32.hout, &kk->win32.cci);
    117101
    118102    SetConsoleMode(kk->win32.hout, ENABLE_MOUSE_INPUT);
     
    145129    SetConsoleMode(kk->win32.back, 0);
    146130
    147     GetConsoleCursorInfo(kk->win32.front, &cci);
    148     cci.dwSize = 0;
    149     cci.bVisible = FALSE;
    150     SetConsoleCursorInfo(kk->win32.front, &cci);
    151     SetConsoleCursorInfo(kk->win32.back, &cci);
     131    GetConsoleCursorInfo(kk->win32.front, &kk->win32.cci);
     132    kk->win32.cci.dwSize = 0;
     133    kk->win32.cci.bVisible = FALSE;
     134    SetConsoleCursorInfo(kk->win32.front, &kk->win32.cci);
     135    SetConsoleCursorInfo(kk->win32.back, &kk->win32.cci);
    152136
    153137    SetConsoleActiveScreenBuffer(kk->win32.front);
     
    161145}
    162146
    163 int win32_end_graphics(caca_t *kk)
     147static int win32_end_graphics(caca_t *kk)
    164148{
    165149    SetConsoleActiveScreenBuffer(kk->win32.hout);
     
    171155                                             | FOREGROUND_GREEN
    172156                                             | FOREGROUND_BLUE);
    173     cci.bVisible = TRUE;
    174     SetConsoleCursorInfo(kk->win32.hout, &cci);
     157    kk->win32.cci.bVisible = TRUE;
     158    SetConsoleCursorInfo(kk->win32.hout, &kk->win32.cci);
    175159    CloseHandle(kk->win32.hout);
    176160
     
    178162}
    179163
    180 int win32_set_window_title(caca_t *kk, char const *title)
     164static int win32_set_window_title(caca_t *kk, char const *title)
    181165{
    182166    SetConsoleTitle(title);
     
    184168}
    185169
    186 unsigned int win32_get_window_width(caca_t *kk)
     170static unsigned int win32_get_window_width(caca_t *kk)
    187171{
    188172    /* FIXME */
     
    192176}
    193177
    194 unsigned int win32_get_window_height(caca_t *kk)
     178static unsigned int win32_get_window_height(caca_t *kk)
    195179{
    196180    /* FIXME */
     
    200184}
    201185
    202 void win32_display(caca_t *kk)
     186static void win32_display(caca_t *kk)
    203187{
    204188    COORD size, pos;
     
    225209}
    226210
    227 void win32_handle_resize(caca_t *kk)
    228 {
    229     unsigned int new_width, new_height;
    230 
    231     new_width = kk->qq->width;
    232     new_height = kk->qq->height;
    233 
     211static void win32_handle_resize(caca_t *kk, unsigned int *new_width,
     212                                            unsigned int *new_height)
     213{
    234214    /* Nothing to do here. */
     215    *new_width = kk->qq->width;
     216    *new_height = kk->qq->height;
    235217}
    236218
Note: See TracChangeset for help on using the changeset viewer.