本文整理汇总了C++中TFT::stroke方法的典型用法代码示例。如果您正苦于以下问题:C++ TFT::stroke方法的具体用法?C++ TFT::stroke怎么用?C++ TFT::stroke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TFT
的用法示例。
在下文中一共展示了TFT::stroke方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawPellet
// Draw a 9x9 pellet
void Board::drawPellet(Pellet pellet){
TFTscreen.stroke(56, 3, 200);
for(int i = -3; i <= 3; i++){
for(int j = -3; j <= 3; j++){
TFTscreen.point(pellet.xPos + i, pellet.yPos + j);
}
}
TFTscreen.stroke(0,0,0);
}
示例2: 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);
}
}
示例3: 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()]);
}
示例4: clearPoint
// Clear (draw black) 9x9 square
void Board::clearPoint(int xPoint, int yPoint){
TFTscreen.stroke(0, 0, 0);
for(int i = -3; i <= 3; i++){
for(int j = -3; j <= 3; j++){
TFTscreen.point(xPoint + i, yPoint + j);
}
}
}
示例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);
}
示例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);
}
示例7: 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());
}
示例8: 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());
}
示例9: drawPointFast
// Draws snake body as single point(1 pixel)
void Board::drawPointFast(uint8_t xPoint, uint8_t yPoint){
// Set new stroke
TFTscreen.stroke(rgbColour[0], rgbColour[1], rgbColour[2]);
// Draw 9x9 square
TFTscreen.point(xPoint, yPoint);
// Set new colors
updateColors();
}
示例10: 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());
}
示例11: 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());
}
示例12: 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);
}
示例13: drawPoint
// Draws a 9X9 point with (xPoint, yPoint) as center
void Board::drawPoint(uint8_t xPoint, uint8_t yPoint){
// set new stroke
TFTscreen.stroke(rgbColour[0], rgbColour[1], rgbColour[2]);
//Draw 9x9 square
for(int i = -3; i <= 3; i++){
for(int j = -3; j <= 3; j++){
TFTscreen.point(((int)xPoint) + i, ((int)yPoint) + j);
}
}
// Set new colors
updateColors();
}
示例14: 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");
}
示例15: 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]);
}