Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void loop() {
- ABWindow *window;
- bool focused;
- // pause render until it's time for the next frame
- if (!(arduboy.nextFrame()))
- return;
- arduboy.clear();
- // we set our cursor 5 pixels to the right and 10 down from the top
- // (positions start at 0, 0)
- // arduboy.setCursor(4, 9);
- // then we print to screen what is in the Quotation marks ""
- // arduboy.print(F("Hello, world!"));
- app.tick();
- // z-indexing
- for (int8_t z=-1; z<10; z++) {
- for (uint8_t w=0; w < MAX_WINDOWS; w++) {
- window = &app.windows[w];
- if (window->zIndex == z && window->live()) {
- // we need to save the focus state because the event handler
- // could change it out from under us
- focused = window->focused;
- // only the focused window receives access to button state
- if (!focused) { app.pushButtons(); }
- if (window->eventHandler != NULL) {
- window->eventHandler(TICK_EVENT);
- }
- window->renderHandler();
- // we pop after render so render does not have "secret" knowledge
- // of buttons that the event handler does not have access to
- if (!focused) { app.popButtons(); }
- }
- }
- }
- arduboy.setCursor(0,0);
- // then we finaly we tell the arduboy to display what we just wrote to the display
- arduboy.display();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement