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.
Dependencies: mbed Gamepad N5110
life.cpp
00001 #include "life.h" 00002 00003 void life::init(){ 00004 _x = 0; 00005 _y = 0; 00006 _num = 4; 00007 _width = 8; 00008 _height = 7; 00009 int d[56] = { 00010 0,1,1,0,0,1,1,0, 00011 1,1,1,1,1,1,1,1, 00012 1,1,0,0,1,1,1,1, 00013 1,1,0,1,1,1,1,1, 00014 0,1,1,1,1,1,1,0, 00015 0,0,1,1,1,1,0,0, 00016 0,0,0,1,1,0,0,0 00017 }; 00018 for(int i = 0; i < 56; i++){ 00019 data[i] = d[i]; 00020 } 00021 } 00022 void life::update(){ 00023 _num = _num - 1; 00024 } 00025 void life::display(N5110 &lcd){ 00026 for(int i = 0; i < _num; i++){ 00027 int x = _x + _width*i; 00028 unsigned int width = _width; 00029 unsigned int height = _height; 00030 Bitmap p(data, height, width); 00031 p.render(lcd, x, _y); 00032 } 00033 } 00034 00035 int life::liferest(){return _num;}
Generated on Sun Aug 7 2022 13:50:18 by
1.7.2