当前位置: 首页>>代码示例>>C++>>正文


C++ TFT::setCursor方法代码示例

本文整理汇总了C++中TFT::setCursor方法的典型用法代码示例。如果您正苦于以下问题:C++ TFT::setCursor方法的具体用法?C++ TFT::setCursor怎么用?C++ TFT::setCursor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TFT的用法示例。


在下文中一共展示了TFT::setCursor方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: winScreen

void Board::winScreen(uint8_t highscore, bool isNewHighscore){
  // Set background color to random
  TFTscreen.background(random(255), random(255), random(255));

  // Print "game over"
  TFTscreen.setTextSize(3);
  TFTscreen.stroke(255, 255, 255);
  TFTscreen.setCursor(0, 40);
  TFTscreen.print(uwin_str);


  // Print "press joystick to restart"
  TFTscreen.setTextSize(1);
  TFTscreen.setCursor(0, 10);
  TFTscreen.print(pressagain_str);

  // Print score
  TFTscreen.setCursor(0, 80);
  TFTscreen.setTextSize(2);
  TFTscreen.print(score_str);
  TFTscreen.print(": ");
  TFTscreen.print(highscore);

  // If score is new highcore, print "new highscore!"
  if(isNewHighscore){
    TFTscreen.setTextSize(1);
    TFTscreen.setCursor(0, 100);
    TFTscreen.print(newHighscore);
  }
}
开发者ID:IdarV,项目名称:Arduino,代码行数:30,代码来源:board.cpp

示例2: writeWeekDay

// Write weekday to screen
void ClockMaster::writeWeekDay(DateTime time_now){
  tft.stroke(weekdayColor);
  tft.setTextSize(weekdaySize);
  tft.setCursor(weekdayXPos, weekdayYPos);

  tft.print(daysOfTheWeek[time_now.dayOfTheWeek()]);
}
开发者ID:IdarV,项目名称:Arduino,代码行数:8,代码来源:ClockMaster.cpp

示例3: writeSecond

// Write second to screen
void ClockMaster::writeSecond(DateTime time_now) {
  tft.stroke(255, 255, 255);
  tft.setTextSize(secondSize);
  tft.setCursor(secondXPos, secondYPos);
  if (time_now.second() < 10) {
    tft.print("0");
  }
  tft.print(time_now.second());
}
开发者ID:IdarV,项目名称:Arduino,代码行数:10,代码来源:ClockMaster.cpp

示例4: writeMinute

// Write minute to screen
void ClockMaster::writeMinute(DateTime time_now) {
  tft.stroke(minuteColor);
  tft.setTextSize(hourSize);
  tft.setCursor(minuteXPos, minuteYPos);
  if (time_now.minute() < 10) {
    tft.print("0");
  }
  tft.print(time_now.minute());
}
开发者ID:IdarV,项目名称:Arduino,代码行数:10,代码来源:ClockMaster.cpp

示例5: setHighScore

// Prints highscore to screen
void Board::setHighScore(uint8_t highscore){
  TFTscreen.stroke(0, 72, 255);
  TFTscreen.setCursor(0, 70);

  TFTscreen.setTextSize(3);
  TFTscreen.print(highscore);

  TFTscreen.setTextSize(1);
}
开发者ID:IdarV,项目名称:Arduino,代码行数:10,代码来源:board.cpp

示例6: setScore

// Prints score to screen
void Board::setScore(uint8_t score){
  TFTscreen.setTextSize(3);
  TFTscreen.setCursor(0, 20);

  // Write old score as black, which erases it
  if(score != 0){
    TFTscreen.stroke(0, 0, 0);
    TFTscreen.print(score - 1);
  }

  // Write new score in color of snake
  TFTscreen.setCursor(0, 20);
  TFTscreen.stroke(rgbColour[0], rgbColour[1], rgbColour[2]);
  TFTscreen.print(score);

  // Reset cursor size
  TFTscreen.setTextSize(1);
}
开发者ID:IdarV,项目名称:Arduino,代码行数:19,代码来源:board.cpp

示例7: writeHour

// Write hour to screen
void ClockMaster::writeHour(DateTime time_now) {
  tft.stroke(255, 255, 255);
  tft.setTextSize(hourSize);
  tft.setCursor(hourXPos, hourYPos);

  if (time_now.hour() < 10) {
    tft.print("0");
  }

  tft.print(time_now.hour());
}
开发者ID:IdarV,项目名称:Arduino,代码行数:12,代码来源:ClockMaster.cpp

示例8: writeDay

// Write day to screen
void ClockMaster::writeDay(DateTime time_now) {
  dayXPos = monthLength + 4; // One space after month
  tft.stroke(255, 255, 255);
  tft.setTextSize(daySize);
  tft.setCursor(dayXPos, dayYPos);

  if (time_now.day() < 10) {
    tft.print("0");
  }

  tft.print(time_now.day());
}
开发者ID:IdarV,项目名称:Arduino,代码行数:13,代码来源:ClockMaster.cpp

示例9: init

void Board::init(){
  // Start screen
  TFTscreen.begin();
  // make the background black
  TFTscreen.background(0, 0, 0);

  // Set starting colors
  rgbColour[0] = 255;
  rgbColour[1] = 0;
  rgbColour[2] = 0;

  // Set which color to be incremented and decremented
  decColour = 0;
  incColour = 1;

  TFTscreen.stroke(255, 255, 255);
  // Draw top border left->right
  TFTscreen.line(boardBorderXLeft, boardBorderYTop, boardBorderXRight, boardBorderYTop);
  // Draw right border top->bottom
  TFTscreen.line(boardBorderXLeft, boardBorderYTop, boardBorderXLeft, boardBoarderYBottom);
  // Draw bottom border left->right
  TFTscreen.line(boardBorderXLeft, boardBoarderYBottom, boardBorderXRight, boardBoarderYBottom);
  // Draw left border
  TFTscreen.line(boardBorderXRight, boardBorderYTop, boardBorderXRight, boardBoarderYBottom);

  // Write score
  TFTscreen.setCursor(10, 10);
  TFTscreen.setTextSize(1);
  TFTscreen.print(score_str);
  setScore(0);

  // Write highscore
  TFTscreen.setTextSize(1);
  TFTscreen.stroke(255, 255, 255);
  TFTscreen.setCursor(10, 50);
  TFTscreen.print(high_str);
  TFTscreen.setCursor(10, 60);
  TFTscreen.print(score_str);
}
开发者ID:IdarV,项目名称:Arduino,代码行数:39,代码来源:board.cpp

示例10: writeTemp

// Write temperature and Humidity to screen
void ClockMaster::writeTemp(){
  tft.stroke(32, 177, 98);
  tft.setTextSize(2);
  tft.setCursor(tempXPos, tempYPos);
  if(-10 < lastTemp && 10 > lastTemp ){
    tft.print("0");
  }
  tft.print(lastTemp);
  tft.print("C ");
  if(-10 < lastTempF && 10 > lastTempF ){
    tft.print("0");
  }
  tft.print(lastTempF);
  tft.print("F ");
  if(-10 < lastHumidity && 10 > lastHumidity ){
    tft.print("0");
  }
  tft.print(lastHumidity);
  tft.print("h");


}
开发者ID:IdarV,项目名称:Arduino,代码行数:23,代码来源:ClockMaster.cpp

示例11: resetDisplayTime

// reset the display
void ClockMaster::resetDisplayTime(DateTime newTime, int currentXPos){

  clearTextLine(secondXPos, secondYPos, secondSize, secondLength);
  writeSecond(newTime);

  clearTextLine(minuteXPos, minuteYPos, minuteSize, minuteLength);
  writeMinute(newTime);

  clearTextLine(hourXPos, hourYPos, hourSize, hourLength);
  writeHour(newTime);

  clearTextLine(dayXPos, dayYPos, daySize, dayLength);
  clearTextLine(weekdayXPos, weekdayYPos, weekdaySize, weekdayLength);
  writeDay(newTime);
  writeWeekDay(newTime);

  clearTextLine(monthXPos, monthYPos, monthSize, monthLength);
  writeMonth(newTime);

  clearTextLine(yearXPos, yearYPos, yearSize, yearLength);
  writeYear(newTime);

  clearTextLine(tempXPos, tempYPos, tempSize, tempLength);
  writeTemp();

  // draw current x-position-indicator
  if(lastAlarmXPos != currentXPos){
    // Center x-position-indicator under current number being changed
    clearTextLine(0, 85, 2, 160);
    if(currentXPos != -1){
      int calculatedXPos = 45 * currentXPos + 30;
      tft.setCursor(calculatedXPos, 85);
      tft.print("-");
    }
  }

  lastAlarmXPos = currentXPos;
}
开发者ID:IdarV,项目名称:Arduino,代码行数:39,代码来源:ClockMaster.cpp

示例12: writeMonth

// Write month to screen
void ClockMaster::writeMonth(DateTime time_now) {
  tft.stroke(255, 255, 255);
  tft.setTextSize(monthSize);
  tft.setCursor(monthXPos, monthYPos);
  tft.print(monthsOfTheYear[time_now.month() - 1]);
}
开发者ID:IdarV,项目名称:Arduino,代码行数:7,代码来源:ClockMaster.cpp

示例13: writeYear

// Write year to screen
void ClockMaster::writeYear(DateTime time_now) {
  tft.stroke(255, 255, 255);
  tft.setTextSize(yearSize);
  tft.setCursor(yearYPos, yearXPos);
  tft.print(time_now.year());
}
开发者ID:IdarV,项目名称:Arduino,代码行数:7,代码来源:ClockMaster.cpp


注:本文中的TFT::setCursor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。