+ got rid of DELAY. * test/demo.c: + Minor animation effect. git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/ttyvaders/trunk@94 92316355-f0b4-4df1-b90c-862c8a59935fmaster
@@ -30,6 +30,8 @@ | |||||
#include "ee.h" | #include "ee.h" | ||||
static int _ee_delay; | |||||
int ee_init(void) | int ee_init(void) | ||||
{ | { | ||||
#ifdef USE_SLANG | #ifdef USE_SLANG | ||||
@@ -93,10 +95,16 @@ int ee_init(void) | |||||
/* Dummy driver */ | /* Dummy driver */ | ||||
#endif | #endif | ||||
_ee_delay = 0; | |||||
return 0; | return 0; | ||||
} | } | ||||
void ee_set_delay(int delay) | |||||
{ | |||||
_ee_delay = delay; | |||||
} | |||||
int ee_get_width(void) | int ee_get_width(void) | ||||
{ | { | ||||
#ifdef USE_SLANG | #ifdef USE_SLANG | ||||
@@ -153,7 +161,6 @@ static int64_t local_time(void) | |||||
return now; | return now; | ||||
} | } | ||||
#define DELAY 40000 | |||||
void ee_refresh(void) | void ee_refresh(void) | ||||
{ | { | ||||
static int64_t local_clock = 0; | static int64_t local_clock = 0; | ||||
@@ -182,12 +189,12 @@ void ee_refresh(void) | |||||
now = local_time(); | now = local_time(); | ||||
if(now < local_clock + DELAY - 10000) | |||||
if(now < local_clock + _ee_delay - 10000) | |||||
{ | { | ||||
usleep(local_clock + DELAY - 10000 - now); | |||||
usleep(local_clock + _ee_delay - 10000 - now); | |||||
} | } | ||||
local_clock += DELAY; | |||||
local_clock += _ee_delay; | |||||
} | } | ||||
void ee_end(void) | void ee_end(void) | ||||
@@ -64,6 +64,7 @@ | |||||
* Prototypes | * Prototypes | ||||
*/ | */ | ||||
int ee_init(void); | int ee_init(void); | ||||
void ee_set_delay(int); | |||||
int ee_get_width(void); | int ee_get_width(void); | ||||
int ee_get_height(void); | int ee_get_height(void); | ||||
void ee_clear(void); | void ee_clear(void); | ||||
@@ -34,6 +34,7 @@ int main(int argc, char **argv) | |||||
/* Go ! */ | /* Go ! */ | ||||
while(!quit) | while(!quit) | ||||
{ | { | ||||
int i; | |||||
char key = ee_get_key(); | char key = ee_get_key(); | ||||
if(key) | if(key) | ||||
{ | { | ||||
@@ -41,8 +42,14 @@ int main(int argc, char **argv) | |||||
} | } | ||||
ee_clear(); | ee_clear(); | ||||
ee_goto(12,14); | |||||
ee_putchar('#'); | |||||
for(i=1000; i--;) | |||||
{ | |||||
ee_goto(ee_rand(0,ee_get_width()-1), | |||||
ee_rand(0,ee_get_height()-1)); | |||||
ee_color(ee_rand(1,10)); | |||||
ee_putchar('#'); | |||||
} | |||||
ee_refresh(); | ee_refresh(); | ||||
} | } | ||||