Subversion Repositories Kolibri OS

Rev

Rev 6492 | Rev 6496 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6492 Rev 6495
Line 12... Line 12...
12
     elements can be used after a successful call to this function
12
     elements can be used after a successful call to this function
13
  */
13
  */
14
  kolibri_gui_init();
14
  kolibri_gui_init();
15
  kolibri_rasterworks_init();
15
  kolibri_rasterworks_init();
16
  /* Set gui_event to REDRAW so that window is drawn in first iteration  */
16
  /* Set gui_event to REDRAW so that window is drawn in first iteration  */
-
 
17
  
17
  unsigned int gui_event = KOLIBRI_EVENT_REDRAW;
18
  unsigned int gui_event;
18
  oskey_t key;
19
  oskey_t key;
-
 
20
  unsigned int pressed_button
-
 
21
  //extern volatile unsigned press_key;
Line 19... Line 22...
19
 
22
 
Line 20... Line -...
20
  kolibri_window *main_window = kolibri_new_window(50, 50, 800, 300, "rasterworks example");
-
 
21
  
-
 
22
  extern volatile unsigned press_key;
23
  kolibri_window *main_window = kolibri_new_window(50, 50, 800, 300, "rasterworks example");
23
  
24
  
Line 24... Line 25...
24
  int ln_str = countUTF8Z("Пример работы", -1);
25
  int ln_str = countUTF8Z("Пример работы", -1);
25
  void *buffi = malloc(768*256*3 * sizeof(char));
26
  void *buffi = malloc(768*256*3 * sizeof(char));
Line 36... Line 37...
36
  drawText(buffi, 0, 64, "Пример работы", ln_str, 0xFF000000, 0x2030C18);
37
  drawText(buffi, 0, 64, "Пример работы", ln_str, 0xFF000000, 0x2030C18);
37
  drawText(buffi, 0, 96, "Пример работы", ln_str, 0xFF000000, 0x4030C18);
38
  drawText(buffi, 0, 96, "Пример работы", ln_str, 0xFF000000, 0x4030C18);
38
  drawText(buffi, 0, 128, "Пример работы", ln_str, 0xFF000000, 0x8030C18);
39
  drawText(buffi, 0, 128, "Пример работы", ln_str, 0xFF000000, 0x8030C18);
39
  drawText(buffi, 0, 160, "Пример работы", ln_str, 0xFF000000, 0x0F031428);
40
  drawText(buffi, 0, 160, "Пример работы", ln_str, 0xFF000000, 0x0F031428);
Line 40... Line 41...
40
  
41
  
41
  do  /* Start of main activity loop */
42
  while(gui_event = get_os_event())
42
    {
43
  {
43
      if(gui_event == KOLIBRI_EVENT_REDRAW)
44
    switch (gui_event)
-
 
45
    {
44
	{
46
      case KOLIBRI_EVENT_REDRAW:
45
	  kolibri_handle_event_redraw(main_window);
47
	    kolibri_handle_event_redraw(main_window);
46
	  DrawBitmap(buffi, 5, 5, 768, 256);
-
 
47
	}
-
 
48
      else if(gui_event == KOLIBRI_EVENT_KEY)
-
 
49
	{
48
	    DrawBitmap(buffi, 5, 5, 768, 256);
50
	  key = get_key();
-
 
51
	  switch (key.code)
-
 
52
	  {
-
 
53
	  }
-
 
Line 54... Line -...
54
	  press_key = key.val;
-
 
55
 
-
 
56
	  kolibri_handle_event_key(main_window);
49
	    break;
57
	}
-
 
58
      else if(gui_event == KOLIBRI_EVENT_BUTTON)
50
	    
59
	{
51
	  case KOLIBRI_EVENT_BUTTON:
60
	  unsigned int pressed_button = kolibri_button_get_identifier();
52
	    pressed_button = kolibri_button_get_identifier();
61
	  switch (pressed_button)
53
	    switch (pressed_button)
62
	  {
54
	    {
63
	      case BUTTON_CLOSE:
55
	        case BUTTON_CLOSE:
-
 
56
	  		kolibri_exit();
64
			kolibri_exit();
57
	    }
65
	  }
58
	    break;
66
	 }
-
 
67
      else if(gui_event == KOLIBRI_EVENT_MOUSE)
59
	    
-
 
60
	  case KOLIBRI_EVENT_MOUSE:
-
 
61
	    kolibri_handle_event_mouse(main_window);
68
	{
62
	    break;
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(); */
63
    }
75
 
64
  }