Changeset 94 for ttyvaders


Ignore:
Timestamp:
Nov 9, 2003, 2:52:40 PM (16 years ago)
Author:
Sam Hocevar
Message:
  • libee/ee.c: + got rid of DELAY.
  • test/demo.c: + Minor animation effect.
Location:
ttyvaders/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • ttyvaders/trunk/libee/ee.c

    r90 r94  
    3030
    3131#include "ee.h"
     32
     33static int _ee_delay;
    3234
    3335int ee_init(void)
     
    9496
    9597#endif
     98    _ee_delay = 0;
    9699
    97100    return 0;
     101}
     102
     103void ee_set_delay(int delay)
     104{
     105    _ee_delay = delay;
    98106}
    99107
     
    154162}
    155163
    156 #define DELAY 40000
    157164void ee_refresh(void)
    158165{
     
    183190    now = local_time();
    184191
    185     if(now < local_clock + DELAY - 10000)
    186     {
    187         usleep(local_clock + DELAY - 10000 - now);
    188     }
    189 
    190     local_clock += DELAY;
     192    if(now < local_clock + _ee_delay - 10000)
     193    {
     194        usleep(local_clock + _ee_delay - 10000 - now);
     195    }
     196
     197    local_clock += _ee_delay;
    191198}
    192199
  • ttyvaders/trunk/libee/ee.h

    r90 r94  
    6565 */
    6666int ee_init(void);
     67void ee_set_delay(int);
    6768int ee_get_width(void);
    6869int ee_get_height(void);
  • ttyvaders/trunk/test/demo.c

    r86 r94  
    3535    while(!quit)
    3636    {
     37        int i;
    3738        char key = ee_get_key();
    3839        if(key)
     
    4243
    4344        ee_clear();
    44         ee_goto(12,14);
    45         ee_putchar('#');
     45        for(i=1000; i--;)
     46        {
     47            ee_goto(ee_rand(0,ee_get_width()-1),
     48                    ee_rand(0,ee_get_height()-1));
     49            ee_color(ee_rand(1,10));
     50            ee_putchar('#');
     51        }
     52
    4653        ee_refresh();
    4754    }
Note: See TracChangeset for help on using the changeset viewer.