Doxygen comments added
Dependencies: mbed Gamepad N5110
Pipes/Pipes.cpp@16:95e3706790e5, 2019-05-09 (annotated)
- Committer:
- rafeh
- Date:
- Thu May 09 14:14:37 2019 +0000
- Revision:
- 16:95e3706790e5
- Parent:
- 14:9a9ac55616c4
Final Submission. I have read and agreed with Statement of Academic Integrity.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rafeh | 3:5409b50b01b0 | 1 | #include "Pipes.h" |
rafeh | 3:5409b50b01b0 | 2 | |
rafeh | 10:75de0f4da176 | 3 | Pipes::Pipes() |
rafeh | 10:75de0f4da176 | 4 | { |
rafeh | 10:75de0f4da176 | 5 | |
rafeh | 10:75de0f4da176 | 6 | } |
rafeh | 10:75de0f4da176 | 7 | |
rafeh | 10:75de0f4da176 | 8 | Pipes::~Pipes() |
rafeh | 10:75de0f4da176 | 9 | { |
rafeh | 10:75de0f4da176 | 10 | |
rafeh | 10:75de0f4da176 | 11 | } |
rafeh | 10:75de0f4da176 | 12 | |
rafeh | 10:75de0f4da176 | 13 | |
rafeh | 10:75de0f4da176 | 14 | |
rafeh | 3:5409b50b01b0 | 15 | void Pipes::init(int x, int height) { |
rafeh | 3:5409b50b01b0 | 16 | _x = x; |
rafeh | 3:5409b50b01b0 | 17 | _height = height; |
rafeh | 3:5409b50b01b0 | 18 | } |
rafeh | 3:5409b50b01b0 | 19 | |
rafeh | 6:bc580b480ac8 | 20 | |
rafeh | 6:bc580b480ac8 | 21 | |
rafeh | 3:5409b50b01b0 | 22 | void Pipes::draw(N5110 &lcd) { |
rafeh | 14:9a9ac55616c4 | 23 | lcd.drawRect(_x,0,6,_height,FILL_BLACK); //draw the top pipe (width 6 pixels) |
rafeh | 14:9a9ac55616c4 | 24 | lcd.drawRect((_x-1),_height,8,3,FILL_BLACK); //draw the top middle slightly wider pipe (width 8 pixels) |
rafeh | 14:9a9ac55616c4 | 25 | lcd.drawRect((_x-1),(_height+23),8,3,FILL_BLACK); //draw the bottom middle slightly wider pipe (width 8 pixels) |
rafeh | 14:9a9ac55616c4 | 26 | lcd.drawRect(_x,(_height+26),6,(84-(_height+26)),FILL_BLACK); //draw the bottom pipe (width 6 pixels) |
rafeh | 3:5409b50b01b0 | 27 | } |
rafeh | 10:75de0f4da176 | 28 | |
rafeh | 14:9a9ac55616c4 | 29 | int Pipes::generate_height() { //generates height for the top pipe in pixels. a random integer between 0 and 25 is generated |
rafeh | 7:05f433e196d6 | 30 | int _random_height=rand() % (25 + 1 - 0) + 0; |
rafeh | 7:05f433e196d6 | 31 | return _random_height; |
rafeh | 7:05f433e196d6 | 32 | } |
rafeh | 7:05f433e196d6 | 33 |