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.

54 lines
1.4 KiB

  1. #include "base.h"
  2. #include "spilcd_gfx.h"
  3. #include "spilcd_font.h"
  4. #include "img_green_screen.h"
  5. #define ABS(x) ((x) < 0 ? -(x) : (x))
  6. #define GLOW (((i + row) % 6)*8)
  7. void draw_background(lcd_t* lcd, uint8 lightness)
  8. {
  9. lcd_setWindow(lcd, 0, 0, lcd->width-1, lcd->height-1);
  10. char* img = header_data;
  11. for (int i = 0; i < lcd->width * lcd->height; i++) {
  12. uint8 pixel[3];
  13. HEADER_PIXEL(img, pixel)
  14. lcd_pushPixel(lcd, pixel[0] * (int)lightness / 255, pixel[1] * (int)lightness / 255, pixel[2] * (int)lightness / 255);
  15. }
  16. }
  17. int main(int argc, char *argv[])
  18. {
  19. lcd_t* lcd = demo_init();
  20. for (int p = 0; p < 20; p++) {
  21. draw_background(lcd, p * 200 / 20);
  22. lcd_redrawBuffer(lcd);
  23. }
  24. int rowy = 9;
  25. for (int i = 0; i < 100; i++) {
  26. draw_background(lcd, 200 - ABS(4 - (i%8)) * 6);
  27. int shift_x = ABS(4 - (i%8)) / 4;
  28. int shift_y = ABS(5 - (i%10)) / 4;
  29. int row = 2;
  30. lcd_drawText(lcd, 12 + shift_x, row*rowy + shift_y, "SPI Term v1.8", 0, 220-GLOW, 0);
  31. row++;
  32. row++;
  33. lcd_drawText(lcd, 8 + shift_x, row*rowy + shift_y, "#/> dir", 0, 220-GLOW, 0);
  34. row++;
  35. lcd_drawText(lcd, 8 + shift_x, row*rowy + shift_y, " a.out", 0, 220-GLOW, 0);
  36. row++;
  37. lcd_drawText(lcd, 8 + shift_x, row*rowy + shift_y, " db.txt", 0, 220-GLOW, 0);
  38. row++;
  39. lcd_drawText(lcd, 8 + shift_x, row*rowy + shift_y, "#/>", 0, 220-GLOW, 0);
  40. lcd_redrawBuffer(lcd);
  41. usleep(1000);
  42. }
  43. demo_deinit(lcd);
  44. return 0;
  45. }