From 69a0fb65c69d1e0d7631d8e2e968e78854cf3d3f Mon Sep 17 00:00:00 2001 From: Serhii Sakhno Date: Sun, 21 Aug 2016 23:16:26 +0000 Subject: [PATCH] revert change in rasterworks_example.c git-svn-id: svn://kolibrios.org@6496 a494cfbc-eb01-0410-851d-a64ba20cac60 --- .../EXAMPLE/rasterworks/rasterworks_example.c | 63 +++++++++++-------- 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/contrib/C_Layer/EXAMPLE/rasterworks/rasterworks_example.c b/contrib/C_Layer/EXAMPLE/rasterworks/rasterworks_example.c index d43799ee94..5ac70e2de8 100644 --- a/contrib/C_Layer/EXAMPLE/rasterworks/rasterworks_example.c +++ b/contrib/C_Layer/EXAMPLE/rasterworks/rasterworks_example.c @@ -14,14 +14,13 @@ int main() kolibri_gui_init(); kolibri_rasterworks_init(); /* Set gui_event to REDRAW so that window is drawn in first iteration */ - - unsigned int gui_event; + unsigned int gui_event = KOLIBRI_EVENT_REDRAW; oskey_t key; - unsigned int pressed_button - //extern volatile unsigned press_key; kolibri_window *main_window = kolibri_new_window(50, 50, 800, 300, "rasterworks example"); + extern volatile unsigned press_key; + int ln_str = countUTF8Z("Пример работы", -1); void *buffi = malloc(768*256*3 * sizeof(char)); @@ -39,28 +38,40 @@ int main() drawText(buffi, 0, 128, "Пример работы", ln_str, 0xFF000000, 0x8030C18); drawText(buffi, 0, 160, "Пример работы", ln_str, 0xFF000000, 0x0F031428); - while(gui_event = get_os_event()) - { - switch (gui_event) + do /* Start of main activity loop */ { - case KOLIBRI_EVENT_REDRAW: - kolibri_handle_event_redraw(main_window); - DrawBitmap(buffi, 5, 5, 768, 256); - break; - - case KOLIBRI_EVENT_BUTTON: - pressed_button = kolibri_button_get_identifier(); - switch (pressed_button) - { - case BUTTON_CLOSE: - kolibri_exit(); - } - break; - - case KOLIBRI_EVENT_MOUSE: - kolibri_handle_event_mouse(main_window); - break; - } - } + if(gui_event == KOLIBRI_EVENT_REDRAW) + { + kolibri_handle_event_redraw(main_window); + DrawBitmap(buffi, 5, 5, 768, 256); + } + else if(gui_event == KOLIBRI_EVENT_KEY) + { + key = get_key(); + switch (key.code) + { + } + press_key = key.val; + + kolibri_handle_event_key(main_window); + } + else if(gui_event == KOLIBRI_EVENT_BUTTON) + { + unsigned int pressed_button = kolibri_button_get_identifier(); + switch (pressed_button) + { + case BUTTON_CLOSE: + kolibri_exit(); + } + } + else if(gui_event == KOLIBRI_EVENT_MOUSE) + { + kolibri_handle_event_mouse(main_window); + } + + } while((gui_event = get_os_event())); /* End of main activity loop */ + + /* kolibri_quit(); */ + return 0; }