![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
test avoid bulled game
Dependencies: C12832_lcd LCD_fonts mbed mbed-rtos
Diff: main.cpp
- Revision:
- 6:e63641e13374
- Parent:
- 5:651879f4f047
- Child:
- 7:defdc7cb4e0b
diff -r 651879f4f047 -r e63641e13374 main.cpp --- a/main.cpp Fri Dec 02 09:37:23 2016 +0000 +++ b/main.cpp Fri Dec 02 13:33:02 2016 +0000 @@ -16,40 +16,24 @@ Mutex jump_mtx; Mutex update_mtx; int jump_flag = 0; - -//int main(){ -// lcd.cls(); -// lcd.set_font((unsigned char*) Arial_9); -// while(1){ -// lcd.print_bm(bitmPerson,2,32-6); -// lcd.copy_to_lcd(); -// wait(0.5); -// lcd.print_bm(bitmPersonB,2,32-6); -// lcd.copy_to_lcd(); -// wait(0.5); -// } -//} +Person h; void a(){ - jump_flag = !jump_flag; + h.jump(); } void receive(void const *argument){ while(true){ - if(button){ - jump_mtx.lock(); - button.rise(&a); - jump_mtx.unlock(); - printf("flag %d\n",jump_flag); - Thread::wait(0.1); - } + jump_mtx.lock(); + button.rise(&a); + jump_mtx.unlock(); + //Thread::wait(0.1); } } int main(){ - Person h(); point p; printf("hello\n"); Thread receive_th(receive); @@ -57,16 +41,15 @@ update_mtx.lock(); p = h.update(); update_mtx.unlock(); - lcd.print_bm(bitmPerson,p.x,p.y); + + //printf("x:%d y:%d\n", p.x,p.y); + lcd.cls(); + lcd.print_bm(bitmPlayer,p.x,p.y); lcd.copy_to_lcd(); - wait(0.5); - lcd.print_bm(bitmPersonB,p.x,p.y); + wait(0.02); + lcd.cls(); + lcd.print_bm(bitmPlayerB,p.x,p.y); lcd.copy_to_lcd(); - wait(0.5); + wait(0.02); } -} - - - - - +} \ No newline at end of file