Subversion Repositories Kolibri OS

Rev

Rev 5132 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5132 Rev 9952
Line 1... Line 1...
1
#include 
1
#include 
Line 2... Line 2...
2
 
2
 
Line 3... Line 3...
3
#define B_SZ	10
3
#define B_SZ  10
Line 4... Line 4...
4
 
4
 
5
static char * Title="BinClock";
5
static char* title = "BinClock";
6
 
6
 
7
static void draw_small_box(int x,int y,int is_on)
7
static void draw_small_box(int x, int y, int is_on)
Line 8... Line 8...
8
{
8
{
9
 draw_bar(x,y,B_SZ,B_SZ,is_on ? 0xFF0000 : 0x103000);
9
   _ksys_draw_bar(x, y, B_SZ, B_SZ, is_on ? 0xFF0000 : 0x103000);
10
}
10
}
11
 
11
 
12
static void draw_box_group(int x,int y,int num)
12
static void draw_box_group(int x, int y, int num)
13
{
13
{
14
 int i,j;
14
    int i, j;
15
 char buf[2];
-
 
16
 buf[0]=(num&(1+2+4+8))+'0';
15
    char buf[2];
17
 buf[1]='\0';
16
    buf[0] = (num&(1+2+4+8))+'0';
18
 for(i=0;i<4;i++)
17
    buf[1] = '\0';
19
 { 
18
    for(i = 0; i < 4; i++) {
20
  j=(B_SZ+2)*i;
19
        j = (B_SZ+2)*i;
21
  draw_small_box(x,y+((B_SZ+2)*i),num & (1<<(3-i)) ? 1 : 0);
20
        draw_small_box(x,y+((B_SZ+2)*i),num & (1<<(3-i)) ? 1 : 0);
Line 22... Line 21...
22
 }
21
    }
23
 draw_bar(x,y+((B_SZ+2)*4),B_SZ,B_SZ,0x800000);
22
    _ksys_draw_bar(x, y+((B_SZ+2)*4),B_SZ,B_SZ, 0x800000);
24
 draw_text_sys(buf,x+2,y+((B_SZ+2)*4)+3,1,0xFFFFFF);
23
    _ksys_draw_text(buf, x+2, y+((B_SZ+2)*4)+3, 1, 0xFFFFFF);
Line 53... Line 52...
53
 draw_hms(22,28);
52
    draw_hms(22, 28);
54
}
53
}
Line 55... Line 54...
55
 
54
 
56
static void paint(void)
55
static void paint(void)
57
{
56
{
58
 BeginDraw();
57
    _ksys_start_draw();
59
 DrawWindow(100,100,40+((B_SZ+2)*6)+4,30+((B_SZ+2)*4)+16,Title,0x80,0x13);
58
    _ksys_create_window(100, 100, 40+((B_SZ+2)*6)+4,30+((B_SZ+2)*4)+16, title, 0x80, 0x13);
60
 draw_bar(20,26,((B_SZ+2)*6)+4+2,4+((B_SZ+1)*4)+2,0);
59
    _ksys_draw_bar(20, 26, ((B_SZ+2)*6)+4+2,4+((B_SZ+1)*4)+2, 0);
61
 draw_h();
60
    draw_h();
62
 EndDraw();
61
    _ksys_end_draw();
Line 63... Line 62...
63
}
62
}
64
 
63
 
65
int main(void)
64
int main(void)
66
{
65
{
-
 
66
    int i;
67
 int i;
67
    paint();
68
 paint();
-
 
69
 for(;;)
68
 
70
 {
69
    for(;;) {
71
  i=wait_for_event(20);
70
        i = _ksys_wait_event_timeout(20);
72
  draw_h();
-
 
73
  switch(i)
71
        draw_h();
74
  {
72
        switch(i) {
75
   case 1:
73
            case 1:
76
    paint();
74
                paint();
77
    continue;
75
                continue;
78
   case 2:
76
            case 2:
79
    get_key();
77
                _ksys_get_key();
80
    continue;
78
                continue;
81
   case 3:
79
            case 3:
82
    if(get_os_button()==1) return 0;
80
                if (_ksys_get_button() == 1) return 0;
83
    continue;
81
                continue;
84
  }
82
        }
Line 85... Line 83...
85
 }
83
    }