Exemple #1
0
void testfillroundrect(void) {
  uint8_t color = BLACK;
  for (int16_t i=0; i<display.height()/2-2; i+=2) {
    display.fillRoundRect(i, i, display.width()-2*i, display.height()-2*i, display.height()/4, color);
    if (color == WHITE) color = BLACK;
    else color = WHITE;
    display.display();
  }
}
Exemple #2
0
/**
   Popup input window with text centered. Window height is based on maxChars
*/
void ANXInputWindow(char * message, char *title, uint8_t maxChars) {

  uint8_t w = (display.width() * .8) + 4;
  uint8_t maxCharsPerRow = w / ANX_FONT_WIDTH;
  uint8_t rows = (maxChars / maxCharsPerRow) + 1;
  uint8_t textHeight = rows * ANX_FONT_HEIGHT;
  uint8_t h = textHeight + ANX_FONT_HEIGHT + 3 + 2;
  uint8_t x = (display.width() - w) / 2;
  uint8_t y = (display.height() - h) / 2;
  uint8_t tx = (display.width() - (ANX_FONT_WIDTH * strlen(title))) / 2;
  uint8_t ty = y + 1;

  display.fillRoundRect(x, y, w, h, 2, BLACK);
  display.drawRoundRect(x, y, w, h, 2, WHITE);
  display.fillRoundRect(x, y, w, ANX_FONT_HEIGHT + 1, 2, WHITE);

  display.setCursor(tx, ty);
  display.setTextColor(INVERSE);
  display.print(title);

  ANXInput(message, x + 2, y + ANX_FONT_HEIGHT + 3, maxChars, maxCharsPerRow);
}