Ignore:
Timestamp:
Mar 6, 2006, 9:32:40 AM (15 years ago)
Author:
Sam Hocevar
Message:
  • All output plugins should now work again.
  • Renamed caca_refresh() into caca_display() which makes more sense.
  • Optimised gl_bgpal by directly storing floats instead of doing the conversion at runtime.
  • Handle resizing in cucul_set_size() and try to keep as much information as possible from the previous canvas.
  • Moved most global variables into cucul_t or caca_t contexts.
  • Moved time.c into libcaca.
File:
1 edited

Legend:

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

    r524 r527  
    11/*
    22 *  libcaca       ASCII-Art library
    3  *  Copyright (c) 2002, 2003 Sam Hocevar <sam@zoy.org>
     3 *  Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org>
    44 *                All Rights Reserved
    55 *
     
    167167    if(kk->driver == CACA_DRIVER_WIN32)
    168168    {
    169         /* This call is allowed to fail in cas we already have a console */
     169        /* This call is allowed to fail in case we already have a console */
    170170        AllocConsole();
    171171
    172         win32_hin = GetStdHandle(STD_INPUT_HANDLE);
    173         win32_hout = CreateFile("CONOUT$", GENERIC_READ | GENERIC_WRITE,
    174                                 FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
    175                                 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
    176 
    177         if(win32_hout == INVALID_HANDLE_VALUE)
     172        kk->win32.hin = GetStdHandle(STD_INPUT_HANDLE);
     173        kk->win32.hout = CreateFile("CONOUT$", GENERIC_READ | GENERIC_WRITE,
     174                                    FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
     175                                    OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
     176
     177        if(kk->win32.hout == INVALID_HANDLE_VALUE)
    178178            return NULL;
    179179
    180         GetConsoleCursorInfo(win32_hout, &cci);
     180        GetConsoleCursorInfo(kk->win32.hout, &cci);
    181181        cci.bVisible = FALSE;
    182         SetConsoleCursorInfo(win32_hout, &cci);
    183 
    184         SetConsoleMode(win32_hout, ENABLE_MOUSE_INPUT);
     182        SetConsoleCursorInfo(kk->win32.hout, &cci);
     183
     184        SetConsoleMode(kk->win32.hout, ENABLE_MOUSE_INPUT);
    185185    }
    186186    else
     
    197197    }
    198198
     199    /* Initialise events stuff */
     200    kk->events.key_timer.last_sec = 0;
     201    kk->events.key_timer.last_usec = 0;
     202    kk->events.last_key_ticks = 0;
     203    kk->events.autorepeat_ticks = 0;
     204    kk->events.last_key = 0;
     205
    199206    qq->refcount++;
    200207    kk->qq = qq;
     208
     209    kk->timer.last_sec = 0;
     210    kk->timer.last_usec = 0;
     211    kk->lastticks = 0;
    201212
    202213    kk->resize = 0;
     
    255266    if(kk->driver == CACA_DRIVER_WIN32)
    256267    {
    257         SetConsoleTextAttribute(win32_hout, FOREGROUND_INTENSITY
    258                                              | FOREGROUND_RED
    259                                              | FOREGROUND_GREEN
    260                                              | FOREGROUND_BLUE);
     268        SetConsoleTextAttribute(kk->win32.hout, FOREGROUND_INTENSITY
     269                                                 | FOREGROUND_RED
     270                                                 | FOREGROUND_GREEN
     271                                                 | FOREGROUND_BLUE);
    261272        cci.bVisible = TRUE;
    262         SetConsoleCursorInfo(win32_hout, &cci);
    263         CloseHandle(win32_hout);
     273        SetConsoleCursorInfo(kk->win32.hout, &cci);
     274        CloseHandle(kk->win32.hout);
    264275    }
    265276    else
Note: See TracChangeset for help on using the changeset viewer.