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.h@24:166d726b0f13, 2018-05-08 (annotated)
- Committer:
- ahmedhedait
- Date:
- Tue May 08 13:39:31 2018 +0000
- Revision:
- 24:166d726b0f13
- Parent:
- 22:745b4d352183
Doxygen documentation for classes completed.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ahmedhedait | 17:68d4b4095d80 | 1 | #ifndef MAZEENGINE_H |
| ahmedhedait | 17:68d4b4095d80 | 2 | #define MAZEENGINE_H |
| ahmedhedait | 17:68d4b4095d80 | 3 | |
| ahmedhedait | 17:68d4b4095d80 | 4 | #include "mbed.h" |
| ahmedhedait | 17:68d4b4095d80 | 5 | #include "N5110.h" |
| ahmedhedait | 17:68d4b4095d80 | 6 | #include "Gamepad.h" |
| ahmedhedait | 18:d18b9185fa4f | 7 | #include "Maze.h" |
| ahmedhedait | 18:d18b9185fa4f | 8 | #include "Ball.h" |
| ahmedhedait | 17:68d4b4095d80 | 9 | |
| ahmedhedait | 24:166d726b0f13 | 10 | /** MazeEngine Class |
| ahmedhedait | 24:166d726b0f13 | 11 | @author Ahmed Hedait, University of Leeds |
| ahmedhedait | 24:166d726b0f13 | 12 | @brief When goal is reaches at end of the game. |
| ahmedhedait | 24:166d726b0f13 | 13 | @date May 2018 |
| ahmedhedait | 24:166d726b0f13 | 14 | */ |
| ahmedhedait | 24:166d726b0f13 | 15 | |
| ahmedhedait | 17:68d4b4095d80 | 16 | class MazeEngine |
| ahmedhedait | 17:68d4b4095d80 | 17 | { |
| ahmedhedait | 17:68d4b4095d80 | 18 | public: |
| ahmedhedait | 17:68d4b4095d80 | 19 | |
| ahmedhedait | 24:166d726b0f13 | 20 | /** Constructor */ |
| ahmedhedait | 17:68d4b4095d80 | 21 | MazeEngine(); |
| ahmedhedait | 24:166d726b0f13 | 22 | |
| ahmedhedait | 24:166d726b0f13 | 23 | /** Destructor */ |
| ahmedhedait | 17:68d4b4095d80 | 24 | ~MazeEngine(); |
| ahmedhedait | 21:bcc84d5cb068 | 25 | |
| ahmedhedait | 19:c6ebd1394bda | 26 | void init(); |
| ahmedhedait | 24:166d726b0f13 | 27 | |
| ahmedhedait | 24:166d726b0f13 | 28 | /** Read the inputs of the game. |
| ahmedhedait | 24:166d726b0f13 | 29 | */ |
| ahmedhedait | 19:c6ebd1394bda | 30 | void read_input(Gamepad &pad); |
| ahmedhedait | 24:166d726b0f13 | 31 | |
| ahmedhedait | 24:166d726b0f13 | 32 | /** Intialising the drawing of the ball and maze |
| ahmedhedait | 24:166d726b0f13 | 33 | */ |
| ahmedhedait | 19:c6ebd1394bda | 34 | void draw(N5110 &lcd); |
| ahmedhedait | 24:166d726b0f13 | 35 | |
| ahmedhedait | 24:166d726b0f13 | 36 | /** Updating when the ball goes through the opening hole |
| ahmedhedait | 24:166d726b0f13 | 37 | * @brief Print out that the game is finished and re-start if needed |
| ahmedhedait | 24:166d726b0f13 | 38 | * controlled within the Gamepad Joystick |
| ahmedhedait | 24:166d726b0f13 | 39 | */ |
| ahmedhedait | 20:041affa5e242 | 40 | void update(Gamepad &pad); |
| ahmedhedait | 21:bcc84d5cb068 | 41 | |
| ahmedhedait | 17:68d4b4095d80 | 42 | private: |
| ahmedhedait | 17:68d4b4095d80 | 43 | |
| ahmedhedait | 21:bcc84d5cb068 | 44 | void check_goal(Gamepad &pad); |
| ahmedhedait | 24:166d726b0f13 | 45 | void print_win(N5110 &lcd); |
| ahmedhedait | 22:745b4d352183 | 46 | void check_wall_collision(Gamepad &pad); |
| ahmedhedait | 21:bcc84d5cb068 | 47 | |
| ahmedhedait | 19:c6ebd1394bda | 48 | Maze _maze; |
| ahmedhedait | 20:041affa5e242 | 49 | Direction _dir; |
| ahmedhedait | 20:041affa5e242 | 50 | Ball _ball; |
| ahmedhedait | 21:bcc84d5cb068 | 51 | Vector2D ball_pos; |
| ahmedhedait | 24:166d726b0f13 | 52 | |
| ahmedhedait | 22:745b4d352183 | 53 | int _a; |
| ahmedhedait | 22:745b4d352183 | 54 | int _b; |
| ahmedhedait | 22:745b4d352183 | 55 | int _c; |
| ahmedhedait | 22:745b4d352183 | 56 | int _d; |
| ahmedhedait | 19:c6ebd1394bda | 57 | |
| ahmedhedait | 17:68d4b4095d80 | 58 | }; |
| ahmedhedait | 17:68d4b4095d80 | 59 | #endif |