Rev 6495 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
6492 | punk_joker | 1 | #include |
2 | #include |
||
3 | #include |
||
4 | #include |
||
5 | #include |
||
6 | |||
7 | int main() |
||
8 | { |
||
9 | /* Load all libraries, initialize global tables like system color table and |
||
10 | operations table. kolibri_gui_init() will EXIT with mcall -1 if it fails |
||
11 | to do it's job. This is all you need to call and all libraries and GUI |
||
12 | elements can be used after a successful call to this function |
||
13 | */ |
||
14 | kolibri_gui_init(); |
||
15 | kolibri_rasterworks_init(); |
||
16 | /* Set gui_event to REDRAW so that window is drawn in first iteration */ |
||
6496 | punk_joker | 17 | unsigned int gui_event = KOLIBRI_EVENT_REDRAW; |
6492 | punk_joker | 18 | oskey_t key; |
19 | |||
20 | kolibri_window *main_window = kolibri_new_window(50, 50, 800, 300, "rasterworks example"); |
||
21 | |||
6496 | punk_joker | 22 | extern volatile unsigned press_key; |
23 | |||
6492 | punk_joker | 24 | int ln_str = countUTF8Z("Пример работы", -1); |
25 | void *buffi = malloc(768*256*3 * sizeof(char)); |
||
26 | |||
27 | *((int*)buffi) = 768; |
||
28 | *((int*)buffi+1) = 256; |
||
29 | |||
30 | memset((char*)buffi+8, (char)-1, 768*256*3); |
||
31 | |||
32 | debug_board_printf("String len: %d \n", ln_str); |
||
33 | |||
34 | drawText(buffi, 0, 0, "Пример работы", ln_str, 0xFF000000, 0x30C18); |
||
35 | drawText(buffi, 0, 32, "Пример работы", ln_str, 0xFF000000, 0x1030C18); |
||
36 | drawText(buffi, 0, 64, "Пример работы", ln_str, 0xFF000000, 0x2030C18); |
||
37 | drawText(buffi, 0, 96, "Пример работы", ln_str, 0xFF000000, 0x4030C18); |
||
38 | drawText(buffi, 0, 128, "Пример работы", ln_str, 0xFF000000, 0x8030C18); |
||
39 | drawText(buffi, 0, 160, "Пример работы", ln_str, 0xFF000000, 0x0F031428); |
||
40 | |||
6496 | punk_joker | 41 | do /* Start of main activity loop */ |
6492 | punk_joker | 42 | { |
6496 | punk_joker | 43 | if(gui_event == KOLIBRI_EVENT_REDRAW) |
44 | { |
||
45 | kolibri_handle_event_redraw(main_window); |
||
46 | DrawBitmap(buffi, 5, 5, 768, 256); |
||
47 | } |
||
48 | else if(gui_event == KOLIBRI_EVENT_KEY) |
||
49 | { |
||
50 | key = get_key(); |
||
51 | switch (key.code) |
||
52 | { |
||
53 | } |
||
54 | press_key = key.val; |
||
55 | |||
56 | kolibri_handle_event_key(main_window); |
||
57 | } |
||
58 | else if(gui_event == KOLIBRI_EVENT_BUTTON) |
||
59 | { |
||
60 | unsigned int pressed_button = kolibri_button_get_identifier(); |
||
61 | switch (pressed_button) |
||
62 | { |
||
63 | case BUTTON_CLOSE: |
||
64 | kolibri_exit(); |
||
65 | } |
||
66 | } |
||
67 | else if(gui_event == KOLIBRI_EVENT_MOUSE) |
||
68 | { |
||
69 | kolibri_handle_event_mouse(main_window); |
||
70 | } |
||
71 | |||
72 | } while((gui_event = get_os_event())); /* End of main activity loop */ |
||
73 | |||
74 | /* kolibri_quit(); */ |
||
75 | |||
6492 | punk_joker | 76 | return 0; |
77 | } |