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.
MazeEngine/MazeEngine.cpp@20:041affa5e242, 2018-05-08 (annotated)
- Committer:
- ahmedhedait
- Date:
- Tue May 08 11:57:19 2018 +0000
- Revision:
- 20:041affa5e242
- Parent:
- 19:c6ebd1394bda
- Child:
- 21:bcc84d5cb068
The ball is now capable of moving through the screen with the joystick.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ahmedhedait | 17:68d4b4095d80 | 1 | #include "MazeEngine.h" |
ahmedhedait | 17:68d4b4095d80 | 2 | // nothing doing in the constructor and destructor |
ahmedhedait | 17:68d4b4095d80 | 3 | MazeEngine::MazeEngine() |
ahmedhedait | 17:68d4b4095d80 | 4 | { |
ahmedhedait | 17:68d4b4095d80 | 5 | |
ahmedhedait | 17:68d4b4095d80 | 6 | } |
ahmedhedait | 17:68d4b4095d80 | 7 | |
ahmedhedait | 17:68d4b4095d80 | 8 | MazeEngine::~MazeEngine() |
ahmedhedait | 17:68d4b4095d80 | 9 | { |
ahmedhedait | 17:68d4b4095d80 | 10 | |
ahmedhedait | 19:c6ebd1394bda | 11 | } |
ahmedhedait | 19:c6ebd1394bda | 12 | |
ahmedhedait | 19:c6ebd1394bda | 13 | void MazeEngine::init() |
ahmedhedait | 19:c6ebd1394bda | 14 | { |
ahmedhedait | 20:041affa5e242 | 15 | _ball.init(); |
ahmedhedait | 19:c6ebd1394bda | 16 | } |
ahmedhedait | 19:c6ebd1394bda | 17 | |
ahmedhedait | 19:c6ebd1394bda | 18 | void MazeEngine::read_input(Gamepad &pad) |
ahmedhedait | 19:c6ebd1394bda | 19 | { |
ahmedhedait | 20:041affa5e242 | 20 | _dir = pad.get_direction(); |
ahmedhedait | 20:041affa5e242 | 21 | } |
ahmedhedait | 20:041affa5e242 | 22 | |
ahmedhedait | 20:041affa5e242 | 23 | void MazeEngine::update(Gamepad &pad) |
ahmedhedait | 20:041affa5e242 | 24 | { |
ahmedhedait | 20:041affa5e242 | 25 | _ball.update(_dir); |
ahmedhedait | 19:c6ebd1394bda | 26 | } |
ahmedhedait | 19:c6ebd1394bda | 27 | |
ahmedhedait | 19:c6ebd1394bda | 28 | void MazeEngine::draw(N5110 &lcd) |
ahmedhedait | 19:c6ebd1394bda | 29 | { |
ahmedhedait | 19:c6ebd1394bda | 30 | // draw the elements in the LCD buffer |
ahmedhedait | 19:c6ebd1394bda | 31 | // maze |
ahmedhedait | 19:c6ebd1394bda | 32 | _maze.draw(lcd); |
ahmedhedait | 20:041affa5e242 | 33 | |
ahmedhedait | 20:041affa5e242 | 34 | // ball |
ahmedhedait | 20:041affa5e242 | 35 | _ball.draw(lcd); |
ahmedhedait | 17:68d4b4095d80 | 36 | } |