ELEC2645 (2016/17) / Mbed 2 deprecated Bomb_WeixiTao_el16wt

Dependencies:   mbed

Human/human.cpp

Committer:
weixitao
Date:
2017-05-04
Revision:
3:dd4678a85a1a
Parent:
human.cpp@ 1:83459533ff72

File content as of revision 3:dd4678a85a1a:

#include "human.h"
extern N5110 lcd;
extern Gamepad pad;


double human::humanX()
{
    while(1) {
    Vector2D human_x = pad.get_coord();
    x = (int)(human_x.x*40);         //-1 to 1.
          
    //printf("The value of x(sight) is %i\n",x);
    
    return x;
    
    
    }
}


double human::humanY()
{
    while(1) {
            Vector2D human_y = pad.get_coord();
            y = (int)(-19*human_y.y)-6; //-1 to 1 

            //printf("The value of y(sight) is %i\n",y);
            
    return y;
    }
}


void human:: print_human()
{
    lcd.drawRect(41+x,24+y,3,3,FILL_BLACK); //head
    lcd.drawLine(41+x+1,24+y+3,41+x+1,24+y+6,1); //body
    lcd.drawLine(41+x,24+y+4,41+x+2,24+y+4,1);// hands
    lcd.drawLine(41+x+1,24+y+6,41+x,24+y+7,1);// left leg
    lcd.drawLine(41+x+1,24+y+6,41+x+2,24+y+7,1);// right leg

    lcd.refresh();


    
}