test avoid bulled game

Dependencies:   C12832_lcd LCD_fonts mbed mbed-rtos

Committer:
th_mbed
Date:
Mon Dec 05 08:09:45 2016 +0000
Revision:
8:2fd3eedcde64
Parent:
7:defdc7cb4e0b
Child:
11:cf3cf60589f4
add isGround in Person.; please look at models.h

Who changed what in which revision?

UserRevisionLine numberNew contents of line
th_mbed 0:26e5e770f91b 1 #include "mbed.h"
th_mbed 0:26e5e770f91b 2 #include "C12832_lcd.h"
th_mbed 0:26e5e770f91b 3 #include "Arial_9.h"
th_mbed 0:26e5e770f91b 4 #include "Small_7.h"
th_mbed 0:26e5e770f91b 5 #include "graphics.h"
kaku_jyoko 4:0fe59e58def9 6 #include "models.h"
kaku_jyoko 4:0fe59e58def9 7 #include "rtos.h"
kaku_jyoko 5:651879f4f047 8 #include "point.h"
th_mbed 0:26e5e770f91b 9
th_mbed 0:26e5e770f91b 10 C12832_LCD lcd;
th_mbed 0:26e5e770f91b 11
kaku_jyoko 4:0fe59e58def9 12 // down: p12, left: p13, center: p14, up: p15, right: p16
kaku_jyoko 5:651879f4f047 13 InterruptIn button(p14);
kaku_jyoko 5:651879f4f047 14 DigitalOut led1(LED1);
kaku_jyoko 4:0fe59e58def9 15
kaku_jyoko 5:651879f4f047 16 Mutex jump_mtx;
kaku_jyoko 5:651879f4f047 17 Mutex update_mtx;
kaku_jyoko 4:0fe59e58def9 18 int jump_flag = 0;
kaku_jyoko 6:e63641e13374 19 Person h;
kaku_jyoko 4:0fe59e58def9 20
kaku_jyoko 5:651879f4f047 21 void a(){
kaku_jyoko 6:e63641e13374 22 h.jump();
kaku_jyoko 4:0fe59e58def9 23 }
kaku_jyoko 4:0fe59e58def9 24
kaku_jyoko 4:0fe59e58def9 25 void receive(void const *argument){
kaku_jyoko 4:0fe59e58def9 26 while(true){
kaku_jyoko 6:e63641e13374 27 jump_mtx.lock();
kaku_jyoko 6:e63641e13374 28 button.rise(&a);
kaku_jyoko 6:e63641e13374 29 jump_mtx.unlock();
kaku_jyoko 6:e63641e13374 30 //Thread::wait(0.1);
th_mbed 0:26e5e770f91b 31 }
kaku_jyoko 5:651879f4f047 32 }
kaku_jyoko 5:651879f4f047 33
kaku_jyoko 5:651879f4f047 34 int main(){
kaku_jyoko 5:651879f4f047 35 point p;
kaku_jyoko 5:651879f4f047 36 printf("hello\n");
kaku_jyoko 5:651879f4f047 37 Thread receive_th(receive);
kaku_jyoko 5:651879f4f047 38 while(true){
kaku_jyoko 5:651879f4f047 39 update_mtx.lock();
kaku_jyoko 5:651879f4f047 40 p = h.update();
kaku_jyoko 7:defdc7cb4e0b 41 if(p.y == 0){
kaku_jyoko 7:defdc7cb4e0b 42 }
kaku_jyoko 5:651879f4f047 43 update_mtx.unlock();
kaku_jyoko 6:e63641e13374 44 lcd.cls();
kaku_jyoko 6:e63641e13374 45 lcd.print_bm(bitmPlayer,p.x,p.y);
kaku_jyoko 5:651879f4f047 46 lcd.copy_to_lcd();
kaku_jyoko 6:e63641e13374 47 wait(0.02);
kaku_jyoko 6:e63641e13374 48 lcd.cls();
kaku_jyoko 6:e63641e13374 49 lcd.print_bm(bitmPlayerB,p.x,p.y);
kaku_jyoko 5:651879f4f047 50 lcd.copy_to_lcd();
kaku_jyoko 6:e63641e13374 51 wait(0.02);
kaku_jyoko 5:651879f4f047 52 }
kaku_jyoko 6:e63641e13374 53 }