Yuheng Huo
/
hyh_copy_copy
test
life/life.cpp@4:c7dc43515215, 2020-05-15 (annotated)
- Committer:
- Neowless
- Date:
- Fri May 15 20:36:00 2020 +0000
- Revision:
- 4:c7dc43515215
- Parent:
- 3:31ff7b3e2005
test;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Neowless | 3:31ff7b3e2005 | 1 | #include "life.h" |
Neowless | 3:31ff7b3e2005 | 2 | |
Neowless | 3:31ff7b3e2005 | 3 | void life::init(){ |
Neowless | 3:31ff7b3e2005 | 4 | lives = 3; |
Neowless | 3:31ff7b3e2005 | 5 | int d[56] = { |
Neowless | 3:31ff7b3e2005 | 6 | 0,1,1,0,0,1,1,0, |
Neowless | 3:31ff7b3e2005 | 7 | 1,1,1,1,1,1,1,1, |
Neowless | 3:31ff7b3e2005 | 8 | 1,1,1,1,1,1,1,1, |
Neowless | 3:31ff7b3e2005 | 9 | 1,1,1,1,1,1,1,1, |
Neowless | 3:31ff7b3e2005 | 10 | 0,1,1,1,1,1,1,0, |
Neowless | 3:31ff7b3e2005 | 11 | 0,0,1,1,1,1,0,0, |
Neowless | 3:31ff7b3e2005 | 12 | 0,0,0,1,1,0,0,0}; |
Neowless | 3:31ff7b3e2005 | 13 | } |
Neowless | 3:31ff7b3e2005 | 14 | } |
Neowless | 3:31ff7b3e2005 | 15 | void life::update(){ |
Neowless | 3:31ff7b3e2005 | 16 | lives=lives-1; |
Neowless | 3:31ff7b3e2005 | 17 | |
Neowless | 3:31ff7b3e2005 | 18 | } |
Neowless | 3:31ff7b3e2005 | 19 | void life::display(N5110 &lcd){ |
Neowless | 3:31ff7b3e2005 | 20 | for(int i = 0; i < _num; i++){ |
Neowless | 3:31ff7b3e2005 | 21 | int x = 0 + 8*i; |
Neowless | 3:31ff7b3e2005 | 22 | Bitmap p(icon, 7, 8); |
Neowless | 3:31ff7b3e2005 | 23 | p.render(lcd, x, 0); |
Neowless | 3:31ff7b3e2005 | 24 | } |
Neowless | 3:31ff7b3e2005 | 25 | } |
Neowless | 3:31ff7b3e2005 | 26 | |
Neowless | 3:31ff7b3e2005 | 27 | int life::liferest(){return _num;} |
Neowless | 3:31ff7b3e2005 | 28 |