201199550 Li Boyuan PlaneWar Game on K64f
Dependencies: mbed Gamepad N5110
life.cpp
- Committer:
- LBY
- Date:
- 2020-05-14
- Revision:
- 0:36c99c50e688
File content as of revision 0:36c99c50e688:
#include "life.h" void life::init(){ _x = 0; _y = 0; _num = 4; _width = 8; _height = 7; int d[56] = { 0,1,1,0,0,1,1,0, 1,1,1,1,1,1,1,1, 1,1,0,0,1,1,1,1, 1,1,0,1,1,1,1,1, 0,1,1,1,1,1,1,0, 0,0,1,1,1,1,0,0, 0,0,0,1,1,0,0,0 }; for(int i = 0; i < 56; i++){ data[i] = d[i]; } } void life::update(){ _num = _num - 1; } void life::display(N5110 &lcd){ for(int i = 0; i < _num; i++){ int x = _x + _width*i; unsigned int width = _width; unsigned int height = _height; Bitmap p(data, height, width); p.render(lcd, x, _y); } } int life::liferest(){return _num;}