瀏覽代碼

* 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 年之前
父節點
當前提交
2306fd8758
共有 3 個檔案被更改,包括 21 行新增6 行删除
  1. +11
    -4
      libee/ee.c
  2. +1
    -0
      libee/ee.h
  3. +9
    -2
      test/demo.c

+ 11
- 4
libee/ee.c 查看文件

@@ -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 查看文件

@@ -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 查看文件

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



Loading…
取消
儲存