yr
Revision 0:de980644a94b, committed 2021-03-30
- Comitter:
- tangguangmin
- Date:
- Tue Mar 30 14:11:21 2021 +0000
- Commit message:
- yrt
Changed in this revision
play.cpp | Show annotated file Show diff for this revision Revisions of this file |
play.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r de980644a94b play.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/play.cpp Tue Mar 30 14:11:21 2021 +0000 @@ -0,0 +1,100 @@ +#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(); +// +//} + + + + +
diff -r 000000000000 -r de980644a94b play.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/play.h Tue Mar 30 14:11:21 2021 +0000 @@ -0,0 +1,29 @@ +#ifndef PLAY_H +#define PLAY_H + +#include "mbed.h" +#include "N5110.h" + +#include "monster.h" +#include "shapes.h" +#include "main.h" + +static int score; +static int best_score = 0; + +void initAll(); + +void get_start(N5110 &lcd); + +void store_score(); + +void show_score(N5110 &lcd, DigitalIn &button_A); + +void game_begin(N5110 &lcd, DigitalIn &button_A, DigitalIn &button_B, DigitalIn &button_C, DigitalIn &button_D); + + + + + + +#endif \ No newline at end of file