Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. void loop() {
  2. ABWindow *window;
  3. bool focused;
  4.  
  5. // pause render until it's time for the next frame
  6. if (!(arduboy.nextFrame()))
  7. return;
  8.  
  9. arduboy.clear();
  10.  
  11. // we set our cursor 5 pixels to the right and 10 down from the top
  12. // (positions start at 0, 0)
  13. // arduboy.setCursor(4, 9);
  14.  
  15. // then we print to screen what is in the Quotation marks ""
  16. // arduboy.print(F("Hello, world!"));
  17.  
  18.  
  19. app.tick();
  20.  
  21. // z-indexing
  22. for (int8_t z=-1; z<10; z++) {
  23. for (uint8_t w=0; w < MAX_WINDOWS; w++) {
  24. window = &app.windows[w];
  25. if (window->zIndex == z && window->live()) {
  26. // we need to save the focus state because the event handler
  27. // could change it out from under us
  28. focused = window->focused;
  29. // only the focused window receives access to button state
  30. if (!focused) { app.pushButtons(); }
  31. if (window->eventHandler != NULL) {
  32. window->eventHandler(TICK_EVENT);
  33. }
  34. window->renderHandler();
  35. // we pop after render so render does not have "secret" knowledge
  36. // of buttons that the event handler does not have access to
  37. if (!focused) { app.popButtons(); }
  38. }
  39. }
  40. }
  41.  
  42.  
  43. arduboy.setCursor(0,0);
  44. // then we finaly we tell the arduboy to display what we just wrote to the display
  45. arduboy.display();
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement