Aiming Wu
/
2645_Assignment
Doxyjen of the Bird.h
Copter/Copter.cpp@0:0aea7b9ba421, 2019-05-05 (annotated)
- Committer:
- Wuuu
- Date:
- Sun May 05 16:27:50 2019 +0000
- Revision:
- 0:0aea7b9ba421
Doxyjen of the Bird.h
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Wuuu | 0:0aea7b9ba421 | 1 | #include "Copter.h" |
Wuuu | 0:0aea7b9ba421 | 2 | |
Wuuu | 0:0aea7b9ba421 | 3 | Copter::Copter() |
Wuuu | 0:0aea7b9ba421 | 4 | { |
Wuuu | 0:0aea7b9ba421 | 5 | |
Wuuu | 0:0aea7b9ba421 | 6 | } |
Wuuu | 0:0aea7b9ba421 | 7 | |
Wuuu | 0:0aea7b9ba421 | 8 | Copter::~Copter() |
Wuuu | 0:0aea7b9ba421 | 9 | { |
Wuuu | 0:0aea7b9ba421 | 10 | |
Wuuu | 0:0aea7b9ba421 | 11 | } |
Wuuu | 0:0aea7b9ba421 | 12 | |
Wuuu | 0:0aea7b9ba421 | 13 | void Copter::init() |
Wuuu | 0:0aea7b9ba421 | 14 | { |
Wuuu | 0:0aea7b9ba421 | 15 | _score = 0; |
Wuuu | 0:0aea7b9ba421 | 16 | _h = 0; |
Wuuu | 0:0aea7b9ba421 | 17 | } |
Wuuu | 0:0aea7b9ba421 | 18 | |
Wuuu | 0:0aea7b9ba421 | 19 | Vector2D Copter::get_coord(Gamepad &pad) |
Wuuu | 0:0aea7b9ba421 | 20 | { |
Wuuu | 0:0aea7b9ba421 | 21 | _ans = pad.get_coord(); |
Wuuu | 0:0aea7b9ba421 | 22 | return _ans; |
Wuuu | 0:0aea7b9ba421 | 23 | } |
Wuuu | 0:0aea7b9ba421 | 24 | |
Wuuu | 0:0aea7b9ba421 | 25 | int Copter::get_h() |
Wuuu | 0:0aea7b9ba421 | 26 | { |
Wuuu | 0:0aea7b9ba421 | 27 | _h = 17 * _ans.y; |
Wuuu | 0:0aea7b9ba421 | 28 | return _h; |
Wuuu | 0:0aea7b9ba421 | 29 | } |
Wuuu | 0:0aea7b9ba421 | 30 | |
Wuuu | 0:0aea7b9ba421 | 31 | void Copter::draw(N5110 &lcd) |
Wuuu | 0:0aea7b9ba421 | 32 | { |
Wuuu | 0:0aea7b9ba421 | 33 | int sprite_data[] = { |
Wuuu | 0:0aea7b9ba421 | 34 | 0,0,0,0,0,0,0,0, |
Wuuu | 0:0aea7b9ba421 | 35 | 0,0,0,0,0,0,0,0, |
Wuuu | 0:0aea7b9ba421 | 36 | 0,0,1,1,1,1,1,0, |
Wuuu | 0:0aea7b9ba421 | 37 | 0,0,0,0,1,0,0,0, |
Wuuu | 0:0aea7b9ba421 | 38 | 0,0,0,1,1,1,0,0, |
Wuuu | 0:0aea7b9ba421 | 39 | 0,0,1,1,1,1,1,0, |
Wuuu | 0:0aea7b9ba421 | 40 | 1,1,1,1,1,1,1,1, |
Wuuu | 0:0aea7b9ba421 | 41 | 1,1,1,1,1,1,1,0, |
Wuuu | 0:0aea7b9ba421 | 42 | 0,0,0,0,0,0,0,0, |
Wuuu | 0:0aea7b9ba421 | 43 | 0,0,0,0,0,0,0,0, |
Wuuu | 0:0aea7b9ba421 | 44 | }; |
Wuuu | 0:0aea7b9ba421 | 45 | Bitmap sprite(sprite_data, 10, 8); |
Wuuu | 0:0aea7b9ba421 | 46 | sprite.render(lcd,1,19 - _h); |
Wuuu | 0:0aea7b9ba421 | 47 | } |
Wuuu | 0:0aea7b9ba421 | 48 | |
Wuuu | 0:0aea7b9ba421 | 49 | int Copter::get_score() |
Wuuu | 0:0aea7b9ba421 | 50 | { |
Wuuu | 0:0aea7b9ba421 | 51 | _score++; |
Wuuu | 0:0aea7b9ba421 | 52 | return _score; |
Wuuu | 0:0aea7b9ba421 | 53 | } |