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.
GameEngine/GameEngine.h@14:7419c680656f, 2020-04-26 (annotated)
- Committer:
- evanso
- Date:
- Sun Apr 26 20:31:53 2020 +0000
- Revision:
- 14:7419c680656f
- Parent:
- 13:12276eed13ac
- Child:
- 15:90b6821bcf64
Added map movement test unit and doxygen details to comments.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
evanso | 11:ab578a151f67 | 1 | #ifndef GAMEENGINE_H |
evanso | 11:ab578a151f67 | 2 | #define GAMEENGINE_H |
evanso | 7:0af4ced868f5 | 3 | |
evanso | 13:12276eed13ac | 4 | // Include libraries ----------------------------------------------------------- |
evanso | 7:0af4ced868f5 | 5 | #include "mbed.h" |
evanso | 7:0af4ced868f5 | 6 | #include "N5110.h" |
evanso | 7:0af4ced868f5 | 7 | #include "Gamepad.h" |
evanso | 8:dd1037c5435b | 8 | #include "Spaceship.h" |
evanso | 8:dd1037c5435b | 9 | #include "Map.h" |
evanso | 11:ab578a151f67 | 10 | |
evanso | 7:0af4ced868f5 | 11 | |
evanso | 11:ab578a151f67 | 12 | /** GameEngine class |
evanso | 8:dd1037c5435b | 13 | @brief Runs the different parts of the game |
evanso | 7:0af4ced868f5 | 14 | @author Benjamin Evans, University of Leeds |
evanso | 7:0af4ced868f5 | 15 | @date April 2020 |
evanso | 7:0af4ced868f5 | 16 | */ |
evanso | 8:dd1037c5435b | 17 | |
evanso | 7:0af4ced868f5 | 18 | class GameEngine { |
evanso | 7:0af4ced868f5 | 19 | public: |
evanso | 7:0af4ced868f5 | 20 | /** Constructor */ |
evanso | 7:0af4ced868f5 | 21 | GameEngine(); |
evanso | 7:0af4ced868f5 | 22 | |
evanso | 7:0af4ced868f5 | 23 | /** Destructor */ |
evanso | 7:0af4ced868f5 | 24 | ~GameEngine(); |
evanso | 7:0af4ced868f5 | 25 | |
evanso | 14:7419c680656f | 26 | /** Initalises GameEngine */ |
evanso | 13:12276eed13ac | 27 | void init(); |
evanso | 7:0af4ced868f5 | 28 | |
evanso | 14:7419c680656f | 29 | /** Main gameplay loop that runs playable part of game */ |
evanso | 13:12276eed13ac | 30 | void gameplay_loop(); |
evanso | 11:ab578a151f67 | 31 | |
evanso | 11:ab578a151f67 | 32 | private: |
evanso | 13:12276eed13ac | 33 | // Function prototypes ------------------------------------------------- |
evanso | 11:ab578a151f67 | 34 | |
evanso | 14:7419c680656f | 35 | /** Moves map with spaceship movment */ |
evanso | 13:12276eed13ac | 36 | void map_movement(); |
evanso | 11:ab578a151f67 | 37 | |
evanso | 13:12276eed13ac | 38 | // Variables ----------------------------------------------------------- |
evanso | 11:ab578a151f67 | 39 | |
evanso | 11:ab578a151f67 | 40 | // Changes the drawing x postion of map, 1 moves right, -1 moves left and 0 doesnt change map position |
evanso | 11:ab578a151f67 | 41 | int move_map_; |
evanso | 13:12276eed13ac | 42 | |
evanso | 13:12276eed13ac | 43 | void get_joystick_direction(); |
evanso | 13:12276eed13ac | 44 | |
evanso | 13:12276eed13ac | 45 | // Objects ------------------------------------------------------------- |
evanso | 13:12276eed13ac | 46 | |
evanso | 13:12276eed13ac | 47 | // Gamepad object |
evanso | 13:12276eed13ac | 48 | Gamepad pad; |
evanso | 13:12276eed13ac | 49 | |
evanso | 13:12276eed13ac | 50 | // LCD object |
evanso | 13:12276eed13ac | 51 | N5110 lcd; |
evanso | 13:12276eed13ac | 52 | |
evanso | 13:12276eed13ac | 53 | // Direction object of joystick |
evanso | 13:12276eed13ac | 54 | Direction d_; |
evanso | 13:12276eed13ac | 55 | |
evanso | 13:12276eed13ac | 56 | // Spaceship object |
evanso | 13:12276eed13ac | 57 | Spaceship spaceship; |
evanso | 13:12276eed13ac | 58 | |
evanso | 13:12276eed13ac | 59 | // Map object |
evanso | 13:12276eed13ac | 60 | Map map; |
evanso | 7:0af4ced868f5 | 61 | }; |
evanso | 7:0af4ced868f5 | 62 | |
evanso | 7:0af4ced868f5 | 63 | #endif |