Rev 6492 | Rev 6496 | 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 */ |
||
6495 | punk_joker | 17 | |
18 | unsigned int gui_event; |
||
6492 | punk_joker | 19 | oskey_t key; |
6495 | punk_joker | 20 | unsigned int pressed_button |
21 | //extern volatile unsigned press_key; |
||
6492 | punk_joker | 22 | |
23 | kolibri_window *main_window = kolibri_new_window(50, 50, 800, 300, "rasterworks example"); |
||
24 | |||
25 | int ln_str = countUTF8Z("Пример работы", -1); |
||
26 | void *buffi = malloc(768*256*3 * sizeof(char)); |
||
27 | |||
28 | *((int*)buffi) = 768; |
||
29 | *((int*)buffi+1) = 256; |
||
30 | |||
31 | memset((char*)buffi+8, (char)-1, 768*256*3); |
||
32 | |||
33 | debug_board_printf("String len: %d \n", ln_str); |
||
34 | |||
35 | drawText(buffi, 0, 0, "Пример работы", ln_str, 0xFF000000, 0x30C18); |
||
36 | drawText(buffi, 0, 32, "Пример работы", ln_str, 0xFF000000, 0x1030C18); |
||
37 | drawText(buffi, 0, 64, "Пример работы", ln_str, 0xFF000000, 0x2030C18); |
||
38 | drawText(buffi, 0, 96, "Пример работы", ln_str, 0xFF000000, 0x4030C18); |
||
39 | drawText(buffi, 0, 128, "Пример работы", ln_str, 0xFF000000, 0x8030C18); |
||
40 | drawText(buffi, 0, 160, "Пример работы", ln_str, 0xFF000000, 0x0F031428); |
||
41 | |||
6495 | punk_joker | 42 | while(gui_event = get_os_event()) |
43 | { |
||
44 | switch (gui_event) |
||
6492 | punk_joker | 45 | { |
6495 | punk_joker | 46 | case KOLIBRI_EVENT_REDRAW: |
47 | kolibri_handle_event_redraw(main_window); |
||
48 | DrawBitmap(buffi, 5, 5, 768, 256); |
||
49 | break; |
||
50 | |||
51 | case KOLIBRI_EVENT_BUTTON: |
||
52 | pressed_button = kolibri_button_get_identifier(); |
||
53 | switch (pressed_button) |
||
54 | { |
||
55 | case BUTTON_CLOSE: |
||
56 | kolibri_exit(); |
||
57 | } |
||
58 | break; |
||
59 | |||
60 | case KOLIBRI_EVENT_MOUSE: |
||
61 | kolibri_handle_event_mouse(main_window); |
||
62 | break; |
||
63 | } |
||
64 | } |
||
6492 | punk_joker | 65 | return 0; |
66 | } |