Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Bird/Bird.cpp
- Committer:
- Wuuu
- Date:
- 2019-05-05
- Revision:
- 0:0aea7b9ba421
File content as of revision 0:0aea7b9ba421:
#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;
}