Ignore:
Timestamp:
Nov 5, 2004, 3:44:41 PM (18 years ago)
Author:
Sam Hocevar
Message:
  • examples/: + Use Space to pause demos, Esc to quit.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/examples/cacamoir.c

    r340 r377  
    4747    int red[256], green[256], blue[256], alpha[256];
    4848    struct caca_bitmap *bitmap;
    49     int i, x, y, frame;
     49    int i, x, y, frame = 0, pause = 0;
    5050
    5151    if(caca_init() < 0)
     
    6969
    7070    /* Main loop */
    71     for(frame = 0; !caca_get_event(CACA_EVENT_KEY_PRESS); frame++)
     71    for(;;)
    7272    {
     73        switch(caca_get_event(CACA_EVENT_KEY_PRESS))
     74        {
     75            case CACA_EVENT_KEY_PRESS | CACA_KEY_ESCAPE: goto end;
     76            case CACA_EVENT_KEY_PRESS | ' ': pause = !pause;
     77        }
     78
     79        if(pause)
     80            goto paused;
     81
    7382        memset(screen, 0, XSIZ * YSIZ);
    7483
     
    93102        put_disc(x, y);
    94103
     104        frame++;
     105
     106paused:
    95107        caca_draw_bitmap(0, 0, caca_get_width() - 1, caca_get_height() - 1,
    96108                         bitmap, screen);
     
    98110    }
    99111
     112end:
    100113    caca_free_bitmap(bitmap);
    101114    caca_end();
Note: See TracChangeset for help on using the changeset viewer.