
Zeyu Feng 201377605
Dependencies: mbed
On Minerva
Diff: main.cpp
- Revision:
- 19:5083339b55e8
- Parent:
- 18:93d050e7705d
- Child:
- 20:a36ab1560e73
--- a/main.cpp Thu May 21 15:20:33 2020 +0000 +++ b/main.cpp Thu May 21 17:07:46 2020 +0000 @@ -36,11 +36,7 @@ Timeout timeout; volatile int timer_flag = 0; volatile int timeout_flag = 0; -volatile int count_flag = 18; volatile int paused_flag = 0; -volatile int option_flag = 0; -volatile int defined_rate_flag = 0; -volatile int defined_max_flag = 0; // prototypes void flip(){ timer_flag = 1; } @@ -68,8 +64,8 @@ while(1) { init(); init_value(); - option_flag= interface.menu(lcd,pad,option_flag); - switch(option_flag){ + interface.menu(lcd,pad); + switch(interface.get_menu_flag()){ case 0: main_game(0.15,13); break; @@ -136,11 +132,7 @@ { timer_flag = 0; timeout_flag = 0; - count_flag = 18; paused_flag = 0; - option_flag = 0; - defined_rate_flag = 0; - defined_max_flag = 0; } void control_check() @@ -167,7 +159,7 @@ paused_flag = interface.check_pause(lcd,pad,paused_flag,increment,max); }else{ //if timeout_flag count down number and Joystick have been banned - count_flag = interface.count_down(lcd,count_flag); + interface.count_down(lcd); pad.reset_buttons(); } //control people and check collision @@ -194,7 +186,7 @@ //initialise time out,flag and bottons timeout.attach(&time_out,3); timeout_flag = 0; - count_flag = 18; + interface.set_count_down(18); //count down, each duration 0.5s and 60 beats per minute(1s) sound.count_sound(pad); pad.reset_buttons(); @@ -216,11 +208,11 @@ void undefined() { - defined_rate_flag = interface.undefined_rate(lcd,pad,defined_rate_flag); - defined_max_flag = interface.undefined_max(lcd,pad,defined_max_flag); + interface.undefined_rate(lcd,pad); + interface.undefined_max(lcd,pad); // 0 1 2 3 4 flag // 0.3 0.4 0.5 0.6 0.7 shots/frame // 15 20 25 30 35 Maximum shots - main_game(0.1*(defined_rate_flag + 3),5*(defined_max_flag + 3)); + main_game(0.1*(interface.get_rate_flag() + 3),5*(interface.get_rate_flag()+ 3)); } \ No newline at end of file