Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed FATFileSystem
GolfEngine/GolfEngine.cpp@7:5a19dd9fe8a4, 2019-04-17 (annotated)
- Committer:
- ellisbhastroud
- Date:
- Wed Apr 17 11:13:54 2019 +0000
- Revision:
- 7:5a19dd9fe8a4
- Parent:
- 6:747335f697d6
- Child:
- 8:d410856c6d04
Code made to create levels
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ellisbhastroud | 5:0b31909caf7f | 1 | #include "GolfEngine.h" |
ellisbhastroud | 5:0b31909caf7f | 2 | |
ellisbhastroud | 7:5a19dd9fe8a4 | 3 | // constructor |
ellisbhastroud | 7:5a19dd9fe8a4 | 4 | |
ellisbhastroud | 7:5a19dd9fe8a4 | 5 | GolfEngine::GolfEngine() |
ellisbhastroud | 7:5a19dd9fe8a4 | 6 | { |
ellisbhastroud | 7:5a19dd9fe8a4 | 7 | |
ellisbhastroud | 7:5a19dd9fe8a4 | 8 | } |
ellisbhastroud | 7:5a19dd9fe8a4 | 9 | |
ellisbhastroud | 7:5a19dd9fe8a4 | 10 | //deconstructor |
ellisbhastroud | 7:5a19dd9fe8a4 | 11 | |
ellisbhastroud | 7:5a19dd9fe8a4 | 12 | GolfEngine::~GolfEngine() |
ellisbhastroud | 7:5a19dd9fe8a4 | 13 | { |
ellisbhastroud | 7:5a19dd9fe8a4 | 14 | |
ellisbhastroud | 7:5a19dd9fe8a4 | 15 | } |
ellisbhastroud | 7:5a19dd9fe8a4 | 16 | |
ellisbhastroud | 5:0b31909caf7f | 17 | void GolfEngine::init() |
ellisbhastroud | 5:0b31909caf7f | 18 | { |
ellisbhastroud | 6:747335f697d6 | 19 | |
ellisbhastroud | 5:0b31909caf7f | 20 | } |
ellisbhastroud | 5:0b31909caf7f | 21 | |
ellisbhastroud | 5:0b31909caf7f | 22 | void GolfEngine::drawGame(N5110 &lcd) |
ellisbhastroud | 5:0b31909caf7f | 23 | { |
ellisbhastroud | 5:0b31909caf7f | 24 | _ball.drawBall(lcd); |
ellisbhastroud | 5:0b31909caf7f | 25 | _ball.printShotCount(lcd); |
ellisbhastroud | 5:0b31909caf7f | 26 | drawCourseWalls(lcd); |
ellisbhastroud | 5:0b31909caf7f | 27 | } |
ellisbhastroud | 5:0b31909caf7f | 28 | |
ellisbhastroud | 5:0b31909caf7f | 29 | void GolfEngine::update_ball(Gamepad &pad, int frame_rate) |
ellisbhastroud | 5:0b31909caf7f | 30 | { |
ellisbhastroud | 5:0b31909caf7f | 31 | |
ellisbhastroud | 5:0b31909caf7f | 32 | _ball.shoot_ball(pad); |
ellisbhastroud | 5:0b31909caf7f | 33 | _ball.check_wall_bounce(); |
ellisbhastroud | 5:0b31909caf7f | 34 | _ball.move_ball(frame_rate); |
ellisbhastroud | 5:0b31909caf7f | 35 | _ball.check_wall_bounce(); |
ellisbhastroud | 5:0b31909caf7f | 36 | } |
ellisbhastroud | 5:0b31909caf7f | 37 | |
ellisbhastroud | 5:0b31909caf7f | 38 | void GolfEngine::drawCourseWalls(N5110 &lcd) |
ellisbhastroud | 5:0b31909caf7f | 39 | { |
ellisbhastroud | 5:0b31909caf7f | 40 | for(int i = 0; i > 5; i++) { |
ellisbhastroud | 5:0b31909caf7f | 41 | lcd.drawLine(_level_1[i].start.x,_level_1[i].start.y,_level_1[i].end.x,_level_1[i].end.y,1); //draws line for each wall in course |
ellisbhastroud | 5:0b31909caf7f | 42 | } |
ellisbhastroud | 5:0b31909caf7f | 43 | } |
ellisbhastroud | 5:0b31909caf7f | 44 |