From 426972d291e8eaed9bbd328baf7b01b9e218b79f Mon Sep 17 00:00:00 2001 From: Stefan `Sec` Zehl Date: Fri, 12 Aug 2011 20:07:09 +0200 Subject: [PATCH] Add nick_time animation from SvOlli --- firmware/l0dable/nick_time.c | 58 ++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100755 firmware/l0dable/nick_time.c diff --git a/firmware/l0dable/nick_time.c b/firmware/l0dable/nick_time.c new file mode 100755 index 0000000..8f393a5 --- /dev/null +++ b/firmware/l0dable/nick_time.c @@ -0,0 +1,58 @@ +#include + +#include "basic/basic.h" +#include "basic/config.h" + +#include "lcd/lcd.h" +#include "lcd/print.h" + +#include "usetable.h" + +void ram(void) +{ + struct tm* tm; + char timestr[9]="00:00:00"; + int dx1=0; + int dx2=0; + int dy1=0; + int dy2=0; + setExtFont(GLOBAL(nickfont)); + + dx1=DoString(0,0,GLOBAL(nickname)); + dx1=(RESX-dx1)/2; + if(dx1<0) + { + dx1=0; + } + dy1=(RESY/2-getFontHeight())/2; + dy2=RESY/2 + dy1; + while(getInputRaw()==BTN_NONE) + { + tm = mygmtime(getSeconds()); + + timestr[0] = '0' + tm->tm_hour / 10; + timestr[1] = '0' + tm->tm_hour % 10; + + timestr[3] = '0' + tm->tm_min / 10; + timestr[4] = '0' + tm->tm_min % 10; + + timestr[6] = '0' + tm->tm_sec / 10; + timestr[7] = '0' + tm->tm_sec % 10; + + dx2=DoString(0,0,×tr[0]); + dx2=(RESX-dx2)/2; + if(dx2<0) + { + dx2=0; + } + + lcdClear(); + + DoString(dx1,dy1,GLOBAL(nickname)); + DoString(dx2,dy2,×tr[0]); + + lcdRefresh(); + delayms_queue_plus(10,0); + } + return; +}