Implement basic functions

Dependencies:   mbed N5110

Bird/Bird.cpp

Committer:
Wuuu
Date:
2019-05-03
Revision:
0:64bd9f996099

File content as of revision 0:64bd9f996099:

#include "Bird.h"

Bird::Bird()
{
    
}

Bird::~Bird()
{
    
}

void Bird::init()
{
    _h = 16;
}

int Bird::draw(N5110 &lcd,Gamepad &pad)
{
    int sprite_data1[] = {
    0,0,0,0,0,0,0,0,
    0,0,0,0,0,0,0,0,
    0,0,0,1,0,0,0,0,
    0,0,0,1,1,0,0,0,
    0,0,0,1,1,1,0,0,
    0,0,0,1,1,1,0,0,
    1,1,1,1,1,1,1,1,
    1,1,1,1,1,1,1,0,
    0,0,0,0,0,0,0,0,
    0,0,0,0,0,0,0,0,
    };
    int sprite_data2[] = {
    0,0,0,0,0,0,0,0,
    0,0,0,0,0,0,0,0,
    1,1,1,1,1,1,1,0,
    1,1,1,1,1,1,1,1,
    0,0,0,1,1,1,0,0,
    0,0,0,1,1,1,0,0,
    0,0,0,1,1,0,0,0,
    0,0,0,1,0,0,0,0,
    0,0,0,0,0,0,0,0,
    0,0,0,0,0,0,0,0,
        };
    if(pad.check_event(Gamepad::A_PRESSED) == true){
        _h = _h - 7;
        Bitmap sprite(sprite_data1, 10, 8);
        sprite.render(lcd,1,_h);
    }else{
        _h = _h + 3;
        Bitmap sprite(sprite_data2, 10, 8);
        sprite.render(lcd,1,_h);
    }
    return _h;
}