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

    r339 r377  
    5858    struct caca_bitmap *caca_bitmap;
    5959    float i = 10.0, j = 17.0, k = 11.0;
    60     int p, frame = 0;
     60    int p, frame = 0, pause = 0;
    6161
    6262    if(caca_init())
     
    8787
    8888    /* Go ! */
    89     while(!caca_get_event(CACA_EVENT_KEY_PRESS))
    90     {
     89    for(;;)
     90    {
     91        switch(caca_get_event(CACA_EVENT_KEY_PRESS))
     92        {
     93            case CACA_EVENT_KEY_PRESS | CACA_KEY_ESCAPE: goto end;
     94            case CACA_EVENT_KEY_PRESS | ' ': pause = !pause;
     95        }
     96
     97        if(pause)
     98            goto paused;
     99
    91100        frame++;
    92101
     
    135144            draw_ball(x[p], y[p]);
    136145
     146paused:
    137147        /* Draw our virtual buffer to screen, letting libcaca resize it */
    138148        caca_draw_bitmap(0, 0, caca_get_width() - 1, caca_get_height() - 1,
     
    142152
    143153    /* End, bye folks */
     154end:
     155    caca_free_bitmap(caca_bitmap);
    144156    caca_end();
    145157
Note: See TracChangeset for help on using the changeset viewer.