Subversion Repositories Kolibri OS

Rev

Rev 8171 | Blame | Last modification | View Log | Download | RSS feed

  1. #include <stdlib.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <kos32sys1.h>
  5. #include <clayer/rasterworks.h>
  6.  
  7. // Sizes
  8. int x_size = 768, y_size = 256;
  9.  
  10. // Out example string
  11. char* string = "Пример/Example";
  12.  
  13. int main()
  14. {
  15.     // Count length
  16.     int ln_str = countUTF8Z(string, -1);
  17.    
  18.     // Create image buffer
  19.     void *buffi = malloc(x_size * y_size * 3 * sizeof(char) + 8);
  20.    
  21.     // Set sizes
  22.     *((int*)buffi) = x_size;
  23.     *((int*)buffi+1) = y_size;
  24.    
  25.     // Fill color
  26.     memset((char*)buffi + 8, 0xFF, x_size * y_size * 3);
  27.    
  28.     // Draw text on buffer
  29.     drawText(buffi, 5, 0, string, ln_str, 0xFF000000, 0x30C18);
  30.     drawText(buffi, 5, 32, string, ln_str, 0xFF000000, 0x1030C18);
  31.     drawText(buffi, 5, 64, string, ln_str, 0xFF000000, 0x2030C18);
  32.     drawText(buffi, 5, 96, string, ln_str, 0xFF000000, 0x4030C18);
  33.     drawText(buffi, 5, 128, string, ln_str, 0xFF000000, 0x8030C18);
  34.     drawText(buffi, 5, 160, string, ln_str, 0xFF000000, 0x0F031428);
  35.    
  36.     while (1)
  37.     {
  38.                 switch (get_os_event())
  39.                 {
  40.                         case 1:
  41.                                 BeginDraw();
  42.                                 DrawWindow(50, 50, 800, 300, "Rasterworks Example", 0x999999, 0x34);
  43.                                 DrawBitmap(buffi + 8, 10, 10, 768, 256);
  44.                                 EndDraw();
  45.                                 break;
  46.                         case 2:
  47.                                 get_key();
  48.                                 break;
  49.                         case 3:
  50.                                 if (get_os_button() == 1) exit(0);
  51.                                 break;
  52.                 };
  53.      }
  54.      return 0;
  55. }
  56.