main.c 921 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #include "u8x8.h"
  2. #include <stdio.h>
  3. #include <time.h>
  4. u8x8_t u8x8;
  5. u8log_t u8log;
  6. #define U8LOG_WIDTH 16
  7. #define U8LOG_HEIGHT 8
  8. uint8_t u8log_buf[U8LOG_WIDTH*U8LOG_HEIGHT];
  9. int main(void)
  10. {
  11. int k;
  12. clock_t t;
  13. uint8_t c;
  14. u8x8_Setup_SDL_128x64(&u8x8);
  15. u8x8_InitDisplay(&u8x8);
  16. u8x8_SetFont(&u8x8, u8x8_font_amstrad_cpc_extended_f);
  17. u8log_Init(&u8log, U8LOG_WIDTH, U8LOG_HEIGHT, u8log_buf);
  18. u8log_SetCallback(&u8log, u8log_u8x8_cb, &u8x8);
  19. //u8log_SetRedrawMode(&u8log, /* is_redraw_line_for_each_char = */ 1);
  20. u8log_SetRedrawMode(&u8log, /* is_redraw_line_for_each_char = */ 0);
  21. t = clock()+CLOCKS_PER_SEC/10;
  22. for(;;)
  23. {
  24. if ( t < clock() )
  25. {
  26. c = (t % 10) + '0';
  27. if ( c == '0' )
  28. c = '\n';
  29. u8log_WriteChar(&u8log, c);
  30. t = clock()+CLOCKS_PER_SEC/10;
  31. }
  32. k = u8g_sdl_get_key();
  33. if ( k == 'q' ) break;
  34. }
  35. return 0;
  36. }