1,12 → 1,12 |
#include <kos32sys.h> |
#include <sys/ksys.h> |
|
#define B_SZ 10 |
|
static char * Title="BinClock"; |
static char* title = "BinClock"; |
|
static void draw_small_box(int x,int y,int is_on) |
{ |
draw_bar(x,y,B_SZ,B_SZ,is_on ? 0xFF0000 : 0x103000); |
_ksys_draw_bar(x, y, B_SZ, B_SZ, is_on ? 0xFF0000 : 0x103000); |
} |
|
static void draw_box_group(int x,int y,int num) |
15,13 → 15,12 |
char buf[2]; |
buf[0]=(num&(1+2+4+8))+'0'; |
buf[1]='\0'; |
for(i=0;i<4;i++) |
{ |
for(i = 0; i < 4; i++) { |
j=(B_SZ+2)*i; |
draw_small_box(x,y+((B_SZ+2)*i),num & (1<<(3-i)) ? 1 : 0); |
} |
draw_bar(x,y+((B_SZ+2)*4),B_SZ,B_SZ,0x800000); |
draw_text_sys(buf,x+2,y+((B_SZ+2)*4)+3,1,0xFFFFFF); |
_ksys_draw_bar(x, y+((B_SZ+2)*4),B_SZ,B_SZ, 0x800000); |
_ksys_draw_text(buf, x+2, y+((B_SZ+2)*4)+3, 1, 0xFFFFFF); |
} |
|
static void draw_bcd_num(int x,int y,int num) |
55,11 → 54,11 |
|
static void paint(void) |
{ |
BeginDraw(); |
DrawWindow(100,100,40+((B_SZ+2)*6)+4,30+((B_SZ+2)*4)+16,Title,0x80,0x13); |
draw_bar(20,26,((B_SZ+2)*6)+4+2,4+((B_SZ+1)*4)+2,0); |
_ksys_start_draw(); |
_ksys_create_window(100, 100, 40+((B_SZ+2)*6)+4,30+((B_SZ+2)*4)+16, title, 0x80, 0x13); |
_ksys_draw_bar(20, 26, ((B_SZ+2)*6)+4+2,4+((B_SZ+1)*4)+2, 0); |
draw_h(); |
EndDraw(); |
_ksys_end_draw(); |
} |
|
int main(void) |
66,22 → 65,21 |
{ |
int i; |
paint(); |
for(;;) |
{ |
i=wait_for_event(20); |
|
for(;;) { |
i = _ksys_wait_event_timeout(20); |
draw_h(); |
switch(i) |
{ |
switch(i) { |
case 1: |
paint(); |
continue; |
case 2: |
get_key(); |
_ksys_get_key(); |
continue; |
case 3: |
if(get_os_button()==1) return 0; |
if (_ksys_get_button() == 1) return 0; |
continue; |
} |
} |
} |
|
|