main.c 974 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #include "u8g2.h"
  2. #include <stdio.h>
  3. #include <string.h>
  4. char str1[100];
  5. char str2[100];
  6. u8g2_t u8g2;
  7. int main(void)
  8. {
  9. int x, y;
  10. int k;
  11. char s[10] = "123";
  12. s[0] += 115;
  13. s[1] += 115;
  14. u8g2_SetupBuffer_SDL_128x64_4(&u8g2, &u8g2_cb_r0);
  15. u8x8_InitDisplay(u8g2_GetU8x8(&u8g2));
  16. u8x8_SetPowerSave(u8g2_GetU8x8(&u8g2), 0);
  17. x = 4; // use as height for the box
  18. y = 0;
  19. for(;;)
  20. {
  21. u8g2_FirstPage(&u8g2);
  22. do
  23. {
  24. u8g2_DrawLine(&u8g2, 0, 0, 255, 255);
  25. u8g2_DrawLine(&u8g2, 0, 2, 256, 256+2);
  26. } while( u8g2_NextPage(&u8g2) );
  27. do
  28. {
  29. k = u8g_sdl_get_key();
  30. } while( k < 0 );
  31. if ( k == 273 ) y -= 1;
  32. if ( k == 274 ) y += 1;
  33. if ( k == 276 ) x -= 1;
  34. if ( k == 275 ) x += 1;
  35. if ( k == 'e' ) y -= 1;
  36. if ( k == 'x' ) y += 1;
  37. if ( k == 's' ) x -= 1;
  38. if ( k == 'd' ) x += 1;
  39. if ( k == 'q' ) break;
  40. if ( x < 0 )
  41. x = 0;
  42. }
  43. return 0;
  44. }