yr

play.cpp

Committer:
tangguangmin
Date:
2021-03-30
Revision:
0:de980644a94b

File content as of revision 0:de980644a94b:

#include "play.h"

void store_score() {
    
    if(score > best_score) {
        
        best_score = score;
           
    }
       
}

void get_start(N5110 &lcd) {
    
    lcd.clear();
    
    lcd.printString("LET'S START!",1,2);
    
    lcd.refresh();
    
    thread_sleep_for(100);
    
    //  **************0
    
    lcd.clear();
    
    lcd.printString("3",40,2);
    
    lcd.refresh();
    
    thread_sleep_for(100);
    
    //  **************3
    
    lcd.clear();
    
    lcd.printString("2",40,2);
    
    lcd.refresh();
    
    thread_sleep_for(100);
    
    //  **************2
    
    lcd.clear();
    
    lcd.printString("1",40,2);
    
    lcd.refresh();
    
    thread_sleep_for(100);
    
    //  **************1
    
}

void show_score(N5110 &lcd, DigitalIn &button_A) {
    
    lcd.clear();
    
    lcd.printString("BEST SCORE",12,1);
    
    char buffer[14];
    sprintf(buffer,"%d",best_score);
    lcd.printString(buffer,12,3);
    
    lcd.printString("Press A   BACK",0,5);
    
    lcd.refresh();
    
    while(1) {
     
        if(button_A.read() == 1) {
            choice();
        }    
    }
    
}

//
//InGame::InGame() {}
//
//void InGame::draw_background1(N5110 &lcd) {
//    
//    lcd.clear();
//    
//    lcd.drawLine(0,8,84,7,1);
//    lcd.drawRect(23,26,26,4,FILL_BLACK);
//    lcd.drawRect(0,44,84,4,FILL_BLACK);
//    lcd.drawRect(28,40,26,4,FILL_BLACK);
//    lcd.drawRect(67,22,17,11,FILL_TRANSPARENT);
//    
//    lcd.refresh();
//    
//}