Bläddra i källkod

* libee/ee.c:

+ 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-862c8a59935f
master
sam 21 år sedan
förälder
incheckning
2306fd8758
3 ändrade filer med 21 tillägg och 6 borttagningar
  1. +11
    -4
      libee/ee.c
  2. +1
    -0
      libee/ee.h
  3. +9
    -2
      test/demo.c

+ 11
- 4
libee/ee.c Visa fil

@@ -30,6 +30,8 @@

#include "ee.h"

static int _ee_delay;

int ee_init(void)
{
#ifdef USE_SLANG
@@ -93,10 +95,16 @@ int ee_init(void)
/* Dummy driver */

#endif
_ee_delay = 0;

return 0;
}

void ee_set_delay(int delay)
{
_ee_delay = delay;
}

int ee_get_width(void)
{
#ifdef USE_SLANG
@@ -153,7 +161,6 @@ static int64_t local_time(void)
return now;
}

#define DELAY 40000
void ee_refresh(void)
{
static int64_t local_clock = 0;
@@ -182,12 +189,12 @@ void ee_refresh(void)

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)


+ 1
- 0
libee/ee.h Visa fil

@@ -64,6 +64,7 @@
* Prototypes
*/
int ee_init(void);
void ee_set_delay(int);
int ee_get_width(void);
int ee_get_height(void);
void ee_clear(void);


+ 9
- 2
test/demo.c Visa fil

@@ -34,6 +34,7 @@ int main(int argc, char **argv)
/* Go ! */
while(!quit)
{
int i;
char key = ee_get_key();
if(key)
{
@@ -41,8 +42,14 @@ int main(int argc, char **argv)
}

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();
}



Laddar…
Avbryt
Spara