本文整理汇总了C++中TFT::background方法的典型用法代码示例。如果您正苦于以下问题:C++ TFT::background方法的具体用法?C++ TFT::background怎么用?C++ TFT::background使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TFT
的用法示例。
在下文中一共展示了TFT::background方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例2: initScreen
// Initiate the screen
void ClockMaster::initScreen(){
tft.background(0, 0, 0);
DateTime time_now = getTime();
writeSecond(time_now);
writeMinute(time_now);
writeHour(time_now);
writeDay(time_now);
writeWeekDay(time_now);
writeMonth(time_now);
writeYear(time_now);
}
示例3: 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);
}