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


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

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


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

示例1: mediabuttons

void mediabuttons() {
    // play
    tft.fillScreen(ST7735_BLACK);
    tft.fillRoundRect(25, 10, 78, 60, 8, ST7735_WHITE);
    tft.fillTriangle(42, 20, 42, 60, 90, 40, ST7735_RED);
    delay(500);
    // pause
    tft.fillRoundRect(25, 90, 78, 60, 8, ST7735_WHITE);
    tft.fillRoundRect(39, 98, 20, 45, 5, ST7735_GREEN);
    tft.fillRoundRect(69, 98, 20, 45, 5, ST7735_GREEN);
    delay(500);
    // play color
    tft.fillTriangle(42, 20, 42, 60, 90, 40, ST7735_BLUE);
    delay(50);
    // pause color
    tft.fillRoundRect(39, 98, 20, 45, 5, ST7735_RED);
    tft.fillRoundRect(69, 98, 20, 45, 5, ST7735_RED);
    // play color
    tft.fillTriangle(42, 20, 42, 60, 90, 40, ST7735_GREEN);
}
开发者ID:ubirch,项目名称:ubirch-thgs,代码行数:20,代码来源:tft.cpp

示例2: 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

示例3: main

int main() {
  // SETUP
  init();
  Serial.begin(9600);
  tft.initR(INITR_BLACKTAB);  // initialize screen
  
  // Setting the joystick button and LEDs
  pinMode(JOYSTICK_BUTTON, INPUT);
  digitalWrite(JOYSTICK_BUTTON, HIGH);
  
  // Initialize the SD card
  Serial.print("Initializing SD card...");
  if (!SD.begin(SD_CS)) {
    Serial.println("failed!");
    while(true) {} // something is wrong
  } 
  else {Serial.println("OK!");}
  
  // More initialization
  Serial.print("Initializing Raw SD card...");
  if (!card.init(SPI_HALF_SPEED, SD_CS)) {
    Serial.println("failed!");
    while(true) {} // something is wrong
  } 
  else {Serial.println("OK!");}
  
  // Create states for different modes
  // C1 for Mode 1 - MENU screen
  // C2 for Mode 2 - Snake Game
  // C3 for Mode 3 - GAME OVER screen
  // C4 for Mode 4 - Choose level
  // C5 for Mode 5 - PAUSE screen
  typedef enum {C1 = 1, C2, C3, C4, C5, ERR} State;
  State state = C1;
  int select, snakelength;
  
  while (state!=ERR) {
    if  (state == C1) {
      /// ====== MODE 1 - MENU ====== ///
      Serial.println("Currently in Mode 1");
      snakelength = 1;
      init_vert = analogRead(JOYSTICK_VERT); 
      init_horiz = analogRead(JOYSTICK_HORIZ);
      
      // preparations for the game - to not overlap with the pause menu
      q = q_create(720);
      i = 64; // x component
      j = 80; // y component
      q_add(q,i,j); // load into the queue
      random_x = food_x(); // load x coordinate of food piece
      random_y = food_y(); // load y coordinate of food piece
      pausedirection = 0; // set paused direction to 0
      // reset grid to 0
      for (int a = 0; a < 24; a++) {
        for (int b = 0; b < 30; b++) {
        grid[a][b] = 0;
        }
      }
      
      // display main menu
      snake();
      tft.setTextSize(2);
      
      while(true) {
        // alternate highlighting of START
        unsigned long time = millis()%1000;
        int a = time%1000;
        if ((a<17)) {
        tft.setCursor(34, 83);
        tft.fillRoundRect(30,80,65,20,5,WHITE);
        tft.setTextColor(RED);
        tft.print("START");
        }
        else if ((a>500) && (a<520)) {
        tft.setCursor(34, 83);
        tft.fillRoundRect(30,80,65,20,5,RED);
        tft.setTextColor(WHITE);
        tft.print("START");
        }
        // Read the Joystick - HIGH if not pressed, LOW otherwise
        select = digitalRead(JOYSTICK_BUTTON);     
        if (select == LOW) {
          break;
        }
      }
      state = C4; 
    }
    
    else if (state == C2) {
      /// ====== MODE 2 - SNAKE GAME ====== ///
      Serial.println("Currently in Mode 2");
      delay(50);
      soundsetup(); //setting up sound pin
      // print the background
      tft.fillScreen(DARKRED);
      tft.fillRect(4,5,120,150,DARKGRN);
      
      // print the snake
      int x,y;
      x = q_frontx(q);
//.........这里部分代码省略.........
开发者ID:Mara2020,项目名称:Snake,代码行数:101,代码来源:snake.cpp

示例4: hard

void hard(int box_colour) {
  tft.fillRoundRect(37,130,54,20,5,box_colour);
  tft.setCursor(41, 133); 
  tft.print("HARD");
}
开发者ID:Mara2020,项目名称:Snake,代码行数:5,代码来源:snake.cpp

示例5: medium

void medium(int box_colour) {
  tft.fillRoundRect(25,100,79,20,5,box_colour);
  tft.setCursor(29, 103); 
  tft.print("MEDIUM");
}
开发者ID:Mara2020,项目名称:Snake,代码行数:5,代码来源:snake.cpp

示例6: easy

// To print the difficulty options
void easy(int box_colour) {
  tft.fillRoundRect(37,70,54,20,5,box_colour);
  tft.setCursor(41, 73); 
  tft.print("EASY");
}
开发者ID:Mara2020,项目名称:Snake,代码行数:6,代码来源:snake.cpp


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