![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Final Submission. I have read and agreed with Statement of Academic Integrity.
Dependencies: mbed Gamepad N5110 Joystick
Snake/Snake.cpp@1:b9f3b7d869d8, 2019-05-08 (annotated)
- Committer:
- el16dlc
- Date:
- Wed May 08 19:32:05 2019 +0000
- Revision:
- 1:b9f3b7d869d8
- Child:
- 2:0bd6711eae26
2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el16dlc | 1:b9f3b7d869d8 | 1 | #include "Snake.h" |
el16dlc | 1:b9f3b7d869d8 | 2 | |
el16dlc | 1:b9f3b7d869d8 | 3 | Snake::Snake() { |
el16dlc | 1:b9f3b7d869d8 | 4 | } |
el16dlc | 1:b9f3b7d869d8 | 5 | |
el16dlc | 1:b9f3b7d869d8 | 6 | Snake::~Snake() { |
el16dlc | 1:b9f3b7d869d8 | 7 | } |
el16dlc | 1:b9f3b7d869d8 | 8 | |
el16dlc | 1:b9f3b7d869d8 | 9 | void Snake::init() { |
el16dlc | 1:b9f3b7d869d8 | 10 | _snake_posX = WIDTH/2 - 2; // Snake head set to horizontal centre |
el16dlc | 1:b9f3b7d869d8 | 11 | _snake_posY = HEIGHT/2 - 2; // Snake head set to vertical centre |
el16dlc | 1:b9f3b7d869d8 | 12 | } |
el16dlc | 1:b9f3b7d869d8 | 13 | |
el16dlc | 1:b9f3b7d869d8 | 14 | void Snake::draw_head(N5110 &lcd) { |
el16dlc | 1:b9f3b7d869d8 | 15 | lcd.drawRect(_snake_posX,_snake_posY,4,4,FILL_BLACK); // Draws snake head |
el16dlc | 1:b9f3b7d869d8 | 16 | } |
el16dlc | 1:b9f3b7d869d8 | 17 |