test avoid bulled game

Dependencies:   C12832_lcd LCD_fonts mbed mbed-rtos

main.cpp

Committer:
kaku_jyoko
Date:
2016-12-05
Revision:
11:cf3cf60589f4
Parent:
10:7b2cf5e89e65
Parent:
8:2fd3eedcde64
Child:
17:dfb8d3c5911a

File content as of revision 11:cf3cf60589f4:

#include "mbed.h"
#include "C12832_lcd.h"
#include "Arial_9.h"
#include "Small_7.h"
#include "graphics.h"
#include "models.h"
#include "rtos.h"
#include "point.h"

C12832_LCD lcd;

// down: p12, left: p13, center: p14, up: p15, right: p16
InterruptIn button(p14);
DigitalOut led1(LED1);

Mutex jump_mtx;
Mutex update_mtx;
int jump_flag = 0;
Person h;

void a(){
    h.jump();
}

void receive(void const *argument){
    while(true){
        jump_mtx.lock();
        button.rise(&a);
        jump_mtx.unlock();
        //Thread::wait(0.1);
    }
}

int main(){
    point p;
    printf("hello\n");
    Thread receive_th(receive);
    while(true){
        update_mtx.lock();
        p = h.update();
        if(p.y == 0){
        }
        update_mtx.unlock();
        lcd.cls();
        lcd.print_bm(bitmPlayer,p.x,p.y);
        lcd.print_bm(bitmBullet_graphics, 40, 10);
        lcd.copy_to_lcd();
        wait(0.02);
        lcd.cls();
        lcd.print_bm(bitmPlayerB,p.x,p.y);
        lcd.copy_to_lcd();
        wait(0.02);
    }
}