Yuheng Huo / Mbed 2 deprecated hyh_copy

Dependencies:   mbed FXOS8700CQ

Committer:
Neowless
Date:
Fri May 15 17:44:25 2020 +0000
Revision:
2:cc9d8ec2e1f4
Parent:
1:48b0bf0bcda8
test;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Neowless 1:48b0bf0bcda8 1 #include "life.h"
Neowless 1:48b0bf0bcda8 2
Neowless 1:48b0bf0bcda8 3 void life::init(){
Neowless 1:48b0bf0bcda8 4 _x = 0;
Neowless 1:48b0bf0bcda8 5 _y = 0;
Neowless 2:cc9d8ec2e1f4 6 _num = 3;
Neowless 1:48b0bf0bcda8 7 _width = 8;
Neowless 1:48b0bf0bcda8 8 _height = 7;
Neowless 1:48b0bf0bcda8 9 int d[56] = {
Neowless 1:48b0bf0bcda8 10 0,1,1,0,0,1,1,0,
Neowless 1:48b0bf0bcda8 11 1,1,1,1,1,1,1,1,
Neowless 2:cc9d8ec2e1f4 12 1,1,1,1,1,1,1,1,
Neowless 2:cc9d8ec2e1f4 13 1,1,1,1,1,1,1,1,
Neowless 1:48b0bf0bcda8 14 0,1,1,1,1,1,1,0,
Neowless 1:48b0bf0bcda8 15 0,0,1,1,1,1,0,0,
Neowless 1:48b0bf0bcda8 16 0,0,0,1,1,0,0,0
Neowless 1:48b0bf0bcda8 17 };
Neowless 1:48b0bf0bcda8 18 for(int i = 0; i < 56; i++){
Neowless 2:cc9d8ec2e1f4 19 icon[i] = d[i];
Neowless 1:48b0bf0bcda8 20 }
Neowless 1:48b0bf0bcda8 21 }
Neowless 1:48b0bf0bcda8 22 void life::update(){
Neowless 1:48b0bf0bcda8 23 _num = _num - 1;
Neowless 1:48b0bf0bcda8 24 }
Neowless 1:48b0bf0bcda8 25 void life::display(N5110 &lcd){
Neowless 1:48b0bf0bcda8 26 for(int i = 0; i < _num; i++){
Neowless 1:48b0bf0bcda8 27 int x = _x + _width*i;
Neowless 1:48b0bf0bcda8 28 unsigned int width = _width;
Neowless 1:48b0bf0bcda8 29 unsigned int height = _height;
Neowless 2:cc9d8ec2e1f4 30 Bitmap p(icon, height, width);
Neowless 1:48b0bf0bcda8 31 p.render(lcd, x, _y);
Neowless 1:48b0bf0bcda8 32 }
Neowless 1:48b0bf0bcda8 33 }
Neowless 1:48b0bf0bcda8 34
Neowless 1:48b0bf0bcda8 35 int life::liferest(){return _num;}
Neowless 1:48b0bf0bcda8 36