Zeyu Feng 201377605
Dependencies: mbed
On Minerva
Diff: main.cpp
- Revision:
- 7:c49f3d3b672f
- Parent:
- 6:dce38fe4e092
- Child:
- 8:8287d2ef965d
--- a/main.cpp Tue Apr 28 15:54:41 2020 +0000 +++ b/main.cpp Wed Apr 29 05:10:57 2020 +0000 @@ -1,4 +1,4 @@ -/* +/* ELEC2645 Embedded Systems Project School of Electronic & Electrical Engineering University of Leeds @@ -30,24 +30,25 @@ volatile int timer_flag = 0; // functions -void flip() { +void flip() +{ timer_flag = 1; } void init(); void control_people(); -void shot_update(); +void shot_update(); int main() { //initial init(); - + ticker.attach(&flip,5); - + //a infinite loop to control position of the people, update the game state while(1) { - if(timer_flag == 1){ + if(timer_flag == 1) { timer_flag = 0; if(shot._size < 30) shot._size = shot._size + 2; @@ -59,10 +60,10 @@ lcd.refresh(); //printf("shot refresh\n"); //printf("size = %d\n",shot._size); - wait_ms(100);//fps = 10 + wait_ms(200);//fps = 5 } - + } @@ -72,8 +73,8 @@ lcd.setContrast(0.5); engine.init(); pad.init(); + shot.init(); lcd.refresh(); - shot.init(); } void control_people() @@ -84,9 +85,8 @@ } void shot_update() { - shot.update(); - shot.delete_shot(); - shot.gen_shot(); - shot.draw(lcd); + shot.update(); + shot.delete_shot(); + shot.gen_shot(); + shot.draw(lcd); } - \ No newline at end of file