You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.1 KiB

  1. #include "base.h"
  2. #include "spilcd_gfx.h"
  3. int main(int argc, char *argv[])
  4. {
  5. lcd_t* lcd = demo_init();
  6. printf("Fill display...");
  7. printf("blue...");
  8. lcd_fillScreen(lcd, 0, 70, 160);
  9. lcd_redrawBuffer(lcd);
  10. printf("...waiting 1 second...");
  11. sleep(1);
  12. printf("black...");
  13. lcd_fillScreen(lcd, 0, 0, 0);
  14. lcd_redrawBuffer(lcd);
  15. printf("DONE\n");
  16. printf("...waiting 1 second...\n");
  17. sleep(1);
  18. printf("Points...");
  19. for (int i = 1; i < 2000; i++) {
  20. int r = rand();
  21. lcd_drawPixel(lcd, r % 128, i % 160,
  22. random_color_r(i),
  23. random_color_g(i),
  24. random_color_b(i));
  25. }
  26. lcd_redrawBuffer(lcd);
  27. printf("DONE\n");
  28. printf("...waiting 1 second...\n");
  29. sleep(1);
  30. printf("Regions...");
  31. int w = 15;
  32. int h = 20;
  33. for (int i = 1; i < 100; i++) {
  34. int x = rand() % (128 - w);
  35. int y = rand() % (160 - h);
  36. lcd_setWindow(lcd, x, y, x + w - 1, y + h - 1);
  37. uint8 r = rand();
  38. uint8 g = rand();
  39. uint8 b = rand();
  40. for (int p = 0; p < w*h; p++) {
  41. lcd_pushPixel(lcd, r * p / (w*h), g * (w*h-p) / (w*h), b);
  42. }
  43. lcd_redrawBuffer(lcd);
  44. }
  45. printf("DONE\n");
  46. demo_deinit(lcd);
  47. return 0;
  48. }