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


C++ Adafruit_ST7735::setTextWrap方法代码示例

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


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

示例1: loop

void loop() {
    Serial.println("printing though!");
    tft.fillScreen(ST7735_BLACK);
    // tft.setCursor(0, 0);
    tft.setTextColor(ST7735_WHITE);
    tft.setTextWrap(true);
    // tft.setTextSize(3);
    // tft.setCursor(30, 3);
    tft.setFont(HERO_10);
    tft.drawRightString("OTTAWA",  3);

    tft.setFont(HERO_16);
    tft.setTextSize(2);
    // tft.setCursor(25, 20);
    tft.drawRightString("-1  C", 20);

    tft.setTextSize(1);
    // tft.setCursor(35, 60);
    tft.drawRightString("2:35 PM", 60);

    tft.drawFastHLine(0, 90, tft.width(), ST7735_CYAN);

    tft.setTextWrap(true);
    tft.setFont(CENTURY_8);
    tft.setTextSize(1);
    // tft.setCursor(0, tft.height()-65);
    int yPos = tft.drawString("Stay Hungry, Stay Foolish!",  0,tft.height()-65);
    tft.setTextColor(ST7735_CYAN);
    tft.drawRightString(" - Steve Jobs   ", yPos);
    tft.setTextColor(ST7735_MAGENTA);
    delay(5000);
}
开发者ID:Trekky12,项目名称:Adafruit_ST7735,代码行数:32,代码来源:example.cpp

示例2: setup_display

void setup_display(void) {
  
  // initialize the LCD display
//  tft.init();
//  tft.initR(INITR_BLACKTAB);   // initialize a S6D02A1S chip, black tab
  tft.setRotation(1);
  tft.fillScreen(BLACK); //BLACK);
  //tft.fillRect(0, pos, 160, 128-pos, BLACK); // erase old string
  tft.setCursor(0, 119);
  tft.setTextColor(WHITE);
  tft.setTextWrap(true);
//  tft.print("DD4WH SDR 5.00");
  
  // Show mid screen tune position
  tft.drawFastVLine(pos_centre_f, 0,pos+1, RED); //WHITE);
 // tft.drawFastHLine(0, pos,79, YELLOW);// WHITE);
  //tft.drawFastHLine(81, pos,79, YELLOW);

// draw S-Meter layout
  tft.drawFastHLine (pos_x_smeter, pos_y_smeter-1, 9*s_w, WHITE);
  tft.drawFastHLine (pos_x_smeter, pos_y_smeter+3, 9*s_w, WHITE);
  tft.fillRect(pos_x_smeter, pos_y_smeter-3, 2, 2, WHITE);
  tft.fillRect(pos_x_smeter+8*s_w, pos_y_smeter-3, 2, 2, WHITE);
  tft.fillRect(pos_x_smeter+2*s_w, pos_y_smeter-3, 2, 2, WHITE);
  tft.fillRect(pos_x_smeter+4*s_w, pos_y_smeter-3, 2, 2, WHITE);
  tft.fillRect(pos_x_smeter+6*s_w, pos_y_smeter-3, 2, 2, WHITE);
  tft.fillRect(pos_x_smeter+7*s_w, pos_y_smeter-4, 2, 3, WHITE);
  tft.fillRect(pos_x_smeter+3*s_w, pos_y_smeter-4, 2, 3, WHITE);
  tft.fillRect(pos_x_smeter+5*s_w, pos_y_smeter-4, 2, 3, WHITE);
  tft.fillRect(pos_x_smeter+s_w, pos_y_smeter-4, 2, 3, WHITE);
  tft.fillRect(pos_x_smeter+9*s_w, pos_y_smeter-4, 2, 3, WHITE);
  tft.drawFastHLine (pos_x_smeter+9*s_w, pos_y_smeter-1, 3*s_w*2+2, GREEN);
  tft.drawFastHLine (pos_x_smeter+9*s_w, pos_y_smeter+3, 3*s_w*2+2, GREEN);
  tft.fillRect(pos_x_smeter+11*s_w, pos_y_smeter-4, 2, 3, GREEN);
  tft.fillRect(pos_x_smeter+13*s_w, pos_y_smeter-4, 2, 3, GREEN);
  tft.fillRect(pos_x_smeter+15*s_w, pos_y_smeter-4, 2, 3, GREEN);
  tft.drawFastVLine (pos_x_smeter-1, pos_y_smeter-1, 5, WHITE); 
  tft.drawFastVLine (pos_x_smeter+15*s_w+2, pos_y_smeter-1, 5, GREEN);

  tft.setCursor(pos_x_smeter - 4, pos_y_smeter - 13);
  tft.setTextColor(WHITE);
  tft.setTextWrap(true);
  tft.print("S 1");
  tft.setCursor(pos_x_smeter + 28, pos_y_smeter - 13);
  tft.print("3");
  tft.setCursor(pos_x_smeter + 48, pos_y_smeter - 13);
  tft.print("5");
  tft.setCursor(pos_x_smeter + 68, pos_y_smeter - 13);
  tft.print("7");
  tft.setCursor(pos_x_smeter + 88, pos_y_smeter - 13);
  tft.print("9");
  tft.setCursor(pos_x_smeter + 120, pos_y_smeter - 13);
  tft.print("+20dB");

} // end void setupdisplay
开发者ID:DD4WH,项目名称:Teensy-SDR-Rx,代码行数:55,代码来源:display.cpp

示例3: displayGrid

void displayGrid() {
    tft.fillScreen(0x0000);    // clear the screen with black
    tft.setCursor(0,0);        // set the cursor, indicates where to display
    tft.setTextWrap(false);    // no wrap
   

    tft.print("\n THREES! PUZZLE GAME  \n\n");
    tft.print("      SCORE: ");
    tft.print(score);
    tft.print("\n");


    if (plus) {
        tft.print("            +");
        tft.print(plus);
        tft.print("\n\n");
    }
    else {
        tft.print(" ");
        tft.print("\n\n");
    }

    for(int i=0;i<4;i++) {
        tft.print("  |");

        for(int j=0;j<4;j++) {
            if(grid[i][j]) {
                // use sapce " " to make the interface clear since a number with more digits occupies more space
                if(grid[i][j] < 10) {
                    tft.print(" ");
                    tft.print(grid[i][j]);
                    tft.print(" |");
                }
                else if (grid[i][j] >= 10 && grid[i][j] < 100) {
                    tft.print("");
                    tft.print(grid[i][j]);
                    tft.print(" |");
                }
                else {
                    tft.print("");
                    tft.print(grid[i][j]);
                    tft.print("|");
                }
               
               
            }
            else {
                tft.print(" ");
                tft.print(" ");
                tft.print(" |");
            }
        }
        tft.print("\n\n");
    }
}
开发者ID:TongTongX,项目名称:CPPStudyCode,代码行数:55,代码来源:ThreesProject.cpp

示例4: snake

// Printing
// To print snake main display
void snake() {
  // printing to the screen
  tft.fillScreen(BLACK);
  
  tft.fillRoundRect(14,20,100,40,5,CYAN);
  // where the characters will be displayed
  tft.setCursor(20, 30); 
  tft.setTextColor(BLACK);
  tft.setTextSize(3);
  tft.setTextWrap(true);
  tft.print("SNAKE");
}
开发者ID:Mara2020,项目名称:Snake,代码行数:14,代码来源:snake.cpp

示例5: displayGameOver

void displayGameOver() {
    tft.fillScreen(0x0000);    // clear the screen with black
    tft.setCursor(0,0);        // set the cursor, indicates where to display
    tft.setTextWrap(false);    // no wrap
    tft.setTextSize(3);
    tft.print("\n GAME     \n\n");
    tft.print(" OVER\n\n");
    tft.setTextSize(1);
    tft.print("     SCORE: ");
    tft.print(score);
    //~ tft.print("\n TOP 5 OF THE SCORE LIST ");
    // TO_DO: print out the score list, which needs to be saved in SD cardc
   
}
开发者ID:TongTongX,项目名称:CPPStudyCode,代码行数:14,代码来源:ThreesProject.cpp

示例6: tftPrintTest1

void tftPrintTest1() {
  tft.setTextWrap(false);
  tft.fillScreen(ST7735_BLACK);
  tft.setCursor(0, 30);
  tft.setTextColor(ST7735_RED);
  tft.setTextSize(1);
  tft.println("Hello Sming!");
  tft.setTextColor(ST7735_YELLOW);
  tft.setTextSize(2);
  tft.println("Hello Sming!");
  tft.setTextColor(ST7735_GREEN);
  tft.setTextSize(3);
  tft.println("Hello Sming!");
  tft.setTextColor(ST7735_BLUE);
  tft.setTextSize(4);
  tft.print(1234.567);
}
开发者ID:BorntraegerMarc,项目名称:SmingRTOS,代码行数:17,代码来源:application.cpp

示例7: setup

void setup() {
	Serial.begin(9600);

	// initialise display
	tft.initR(INITR_BLACKTAB);
	tft.fillScreen(ST7735_BLACK);

	// initialise pins
	pinMode(leftPin, INPUT);
	pinMode(rightPin, INPUT);
	pinMode(turnPin, INPUT);
	
	// display splashscreen
	tft.setTextColor(ST7735_WHITE);
	tft.setTextWrap(true);
	
	tft.setCursor(34, 20);
	tft.println("WELCOME TO");
	
	tft.setCursor(45, 30);
	tft.println("~TETRIS");
	
	tft.setCursor(16, 50);
	tft.println("PRESS THE MIDDLE");
	
	tft.setCursor(18, 60);
	tft.println("BUTTON TO START");

	tft.setCursor(57, 110);
	tft.println("BY:");

	tft.setCursor(33, 120);
	tft.println("NICHOLAS LI");

	tft.setCursor(56, 130);
	tft.println("AND");

	tft.setCursor(24, 140);
	tft.println("ARJUN KALBURGI");

	// only continue if turnPin is pressed
	while(digitalRead(turnPin) == LOW) {}

	tft.fillScreen(ST7735_BLACK);
}
开发者ID:askalburgi,项目名称:Arduino_Tetris,代码行数:45,代码来源:tetris.cpp

示例8: intro_display

void intro_display(void) {
  tft.setFont(&FreeSans12pt7b);
  tft.setTextColor(WHITE);
  tft.setTextWrap(true);
  tft.setCursor(0, 30);
  tft.print("Teensy SDR");
  tft.setFont(&FreeSans9pt7b);
  tft.setCursor(0, 50);
  tft.print("by VE3MKC");
  tft.setCursor(0, 80);
  tft.print("PA3BYA");
  tft.setCursor(0, 100);
  tft.print("version: ");
  tft.print(MAIN_VERSION_NUMBER);
  tft.setCursor(0, 120);
  tft.print("build: ");
  tft.print(__DATE__);
}
开发者ID:AgriVision,项目名称:Teensy_SDR,代码行数:18,代码来源:display.cpp

示例9: writeOutRestaurants

/*
 * Writes out at most 20 restaurants on the screen,
 * starting at the index passed in
 */
void writeOutRestaurants(uint16_t startingIndex, RestDist *distances, uint16_t length) {
  tft.fillScreen(0);
  tft.setCursor(0, 0);
  tft.setTextColor(0xFFFF);
  tft.setTextWrap(false);
  
  for (int i = startingIndex; i < 20 + startingIndex; i++) {
    if(i >= length) {
      break;
    }
    Restaurant r;
    getRestaurant(distances[i].index, &r, &card);
    tft.print(i + 1);
    tft.print(". ");
    tft.print(r.name);
    tft.print("\n");
  }
  tft.print("\n");
}
开发者ID:adamjford,项目名称:assignment2,代码行数:23,代码来源:assignment2.cpp

示例10: tftPrintTest

void tftPrintTest() {
    tft.setTextWrap(false);
    tft.fillScreen(ST7735_BLACK);
    tft.setCursor(0, 30);
    tft.setTextColor(ST7735_RED);
    tft.setTextSize(1);
    tft.println("Hello World!");
    tft.setTextColor(ST7735_YELLOW);
    tft.setTextSize(2);
    tft.println("Hello World!");
    tft.setTextColor(ST7735_GREEN);
    tft.setTextSize(3);
    tft.println("Hello World!");
    tft.setTextColor(ST7735_BLUE);
    tft.setTextSize(4);
    tft.print(1234.567);
    delay(1500);
    tft.setCursor(0, 0);
    tft.fillScreen(ST7735_BLACK);
    tft.setTextColor(ST7735_WHITE);
    tft.setTextSize(0);
    tft.println("Hello World!");
    tft.setTextSize(1);
    tft.setTextColor(ST7735_GREEN);
    tft.print(p, 6);
    tft.println(" Want pi?");
    tft.println(" ");
    tft.print(8675309, HEX); // print 8,675,309 out in HEX!
    tft.println(" Print HEX!");
    tft.println(" ");
    tft.setTextColor(ST7735_WHITE);
    tft.println("Sketch has been");
    tft.println("running for: ");
    tft.setTextColor(ST7735_MAGENTA);
    tft.print(millis() / 1000);
    tft.setTextColor(ST7735_WHITE);
    tft.print(" seconds.");
}
开发者ID:ubirch,项目名称:ubirch-thgs,代码行数:38,代码来源:tft.cpp

示例11: show_s_meter_layout

void show_s_meter_layout() {
  tft.drawFastHLine (pos_x_smeter, pos_y_smeter - 1, 9 * s_w, WHITE);
  tft.drawFastHLine (pos_x_smeter, pos_y_smeter + 3, 9 * s_w, WHITE);
  tft.fillRect(pos_x_smeter, pos_y_smeter - 3, 2, 2, WHITE);
  tft.fillRect(pos_x_smeter + 8 * s_w, pos_y_smeter - 3, 2, 2, WHITE);
  tft.fillRect(pos_x_smeter + 2 * s_w, pos_y_smeter - 3, 2, 2, WHITE);
  tft.fillRect(pos_x_smeter + 4 * s_w, pos_y_smeter - 3, 2, 2, WHITE);
  tft.fillRect(pos_x_smeter + 6 * s_w, pos_y_smeter - 3, 2, 2, WHITE);
  tft.fillRect(pos_x_smeter + 7 * s_w, pos_y_smeter - 4, 2, 3, WHITE);
  tft.fillRect(pos_x_smeter + 3 * s_w, pos_y_smeter - 4, 2, 3, WHITE);
  tft.fillRect(pos_x_smeter + 5 * s_w, pos_y_smeter - 4, 2, 3, WHITE);
  tft.fillRect(pos_x_smeter + s_w, pos_y_smeter - 4, 2, 3, WHITE);
  tft.fillRect(pos_x_smeter + 9 * s_w, pos_y_smeter - 4, 2, 3, WHITE);
  tft.drawFastHLine (pos_x_smeter + 9 * s_w, pos_y_smeter - 1, 3 * s_w * 2 + 2, GREEN);
  tft.drawFastHLine (pos_x_smeter + 9 * s_w, pos_y_smeter + 3, 3 * s_w * 2 + 2, GREEN);
  tft.fillRect(pos_x_smeter + 11 * s_w, pos_y_smeter - 4, 2, 3, GREEN);
  tft.fillRect(pos_x_smeter + 13 * s_w, pos_y_smeter - 4, 2, 3, GREEN);
  tft.fillRect(pos_x_smeter + 15 * s_w, pos_y_smeter - 4, 2, 3, GREEN);
  tft.drawFastVLine (pos_x_smeter - 1, pos_y_smeter - 1, 5, WHITE);
  tft.drawFastVLine (pos_x_smeter + 15 * s_w + 2, pos_y_smeter - 1, 5, GREEN);

  tft.setFont();
  tft.setCursor(pos_x_smeter - 4, pos_y_smeter - 13);
  tft.setTextColor(WHITE);
  tft.setTextWrap(true);
  tft.print("S 1");
  tft.setCursor(pos_x_smeter + 28, pos_y_smeter - 13);
  tft.print("3");
  tft.setCursor(pos_x_smeter + 48, pos_y_smeter - 13);
  tft.print("5");
  tft.setCursor(pos_x_smeter + 68, pos_y_smeter - 13);
  tft.print("7");
  tft.setCursor(pos_x_smeter + 88, pos_y_smeter - 13);
  tft.print("9");
  tft.setCursor(pos_x_smeter + 120, pos_y_smeter - 13);
  tft.print("+20dB");
}
开发者ID:AgriVision,项目名称:Teensy_SDR,代码行数:37,代码来源:display.cpp

示例12: finishRound

void finishRound(char result, short& redTotal, short& blueTotal)
{
    // increment score of the winner
    switch(result)
    {
        case 'r':
            redTotal++;
            break;
        case 'b':
            blueTotal++;
            break;
    }

    // set the screen to black
    // and place text cursor in the middle
    tft.fillScreen(0);
    tft.setCursor(srcWidth/2-(40), srcHeight/2);
    tft.setTextWrap(false);

    // winner screen
    if ((redTotal) >= roundsToWin)
    {
    	tft.setTextColor(WHITE);
    	tft.print("GAME FINISHED\n");
        tft.setCursor(srcWidth/2-(30), srcHeight/2 + 14);
    	tft.print("WINNER: ");
    	tft.setTextColor(RED);
    	tft.print("RED");

        // reset scores
    	redTotal = blueTotal = 0;

    	// keep the frame until the user presses the button
    	while (digitalRead(SEL) == HIGH)
        {

        }

    	return;
    }
    else if ((blueTotal) >= roundsToWin)
    {
    	tft.setTextColor(WHITE);
    	tft.print("GAME FINISHED\n");
        tft.setCursor(srcWidth/2-(30), srcHeight/2 + 14);
    	tft.print("WINNER:");

    	tft.setTextColor(BLUE);
    	tft.print("BLUE");

        // reset scores
    	redTotal = blueTotal = 0;

    	// keep the frame until the user presses the button
    	while (digitalRead(SEL) == HIGH)
        {

        }

    	return;
    }

    //place text cursor in the middle
    tft.setCursor(srcWidth/2 - 10, srcWidth/2);
  

    // blue result
    tft.setTextColor(BLUE);
    tft.print(blueTotal);

    tft.setTextColor(WHITE);
    tft.print(" - ");

    // red result
    tft.setTextColor(RED);
    tft.print(redTotal);

    // keep the frame until the user presses the button
    while (digitalRead(SEL) == HIGH)
    {

    }
}
开发者ID:Nessphoro,项目名称:pong,代码行数:83,代码来源:game.cpp

示例13: testdrawtext

void testdrawtext(char *text, uint16_t color) {
    tft.setCursor(0, 0);
    tft.setTextColor(color);
    tft.setTextWrap(true);
    tft.print(text);
}
开发者ID:ubirch,项目名称:ubirch-thgs,代码行数:6,代码来源:tft.cpp

示例14: main


//.........这里部分代码省略.........
          delay(450); // pause when border is hit
          // dissolve the screen
          int m = 0;
          soundLoop();
          while(m < 6000) {
            int rand_x = dissolve_x();
            int rand_y = dissolve_y();
            tft.fillRect(rand_x, rand_y, 5, 5, BLACK);
            m++;
          }
          //~ delay(250);
          state = C3; 
          break;
        }
        
        // Read the Joystick - HIGH if not pressed, LOW otherwise
        select = digitalRead(JOYSTICK_BUTTON);     
        if (select == LOW) {
          state = C5;
          break;
        }
      }
    }
    
    else if (state == C3) {
      /// ====== MODE 3 - GAME OVER ====== ///
      Serial.println("Currently in Mode 3");
      q_destroy(q); // clear the queue
      tft.fillScreen(BLACK);
      tft.fillRoundRect(5,20,118,25,5,RED);
      tft.setCursor(10, 25); 
      tft.setTextColor(BLACK);
      tft.setTextSize(2);
      tft.setTextWrap(true);
      tft.print("GAME OVER");
      tft.print("\n"); 
      
      tft.setCursor(10, 55);
      tft.setTextColor(RED);
      tft.setTextSize(1.5);
      if (snakelength >= 720) {
        snakelength = 720;
        tft.print("YOU WON! CONGRATZ");
      }
      else {
        tft.print("      Oh no!         You hit something!");
      }
      
      tft.setCursor(10, 80);
      tft.setTextColor(WHITE);
      tft.setTextSize(1);
      tft.print("Length of Snake:");
      tft.print(snakelength);
      tft.setCursor(10, 100);
      tft.print("Press the joystick   to return to main    menu");
      
      // Read the Joystick - HIGH if not pressed, LOW otherwise
      while (true) {
        select = digitalRead(JOYSTICK_BUTTON);     
        if (select == LOW) {
          break;
        }
      }
      state = C1;
    }
    
开发者ID:Mara2020,项目名称:Snake,代码行数:66,代码来源:snake.cpp


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