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@8:dd1037c5435b, 2020-04-19 (annotated)
- Committer:
- evanso
- Date:
- Sun Apr 19 17:46:57 2020 +0000
- Revision:
- 8:dd1037c5435b
- Parent:
- 7:0af4ced868f5
- Child:
- 11:ab578a151f67
Added GameEnigne class to run the different parts of the game and tidied up code.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
evanso | 7:0af4ced868f5 | 1 | #ifndef GAMEENIGNE_H |
evanso | 7:0af4ced868f5 | 2 | #define GAMEENIGNE_H |
evanso | 7:0af4ced868f5 | 3 | |
evanso | 7:0af4ced868f5 | 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 | 7:0af4ced868f5 | 10 | |
evanso | 8:dd1037c5435b | 11 | /** Game Engine class |
evanso | 8:dd1037c5435b | 12 | @brief Runs the different parts of the game |
evanso | 7:0af4ced868f5 | 13 | @author Benjamin Evans, University of Leeds |
evanso | 7:0af4ced868f5 | 14 | @date April 2020 |
evanso | 7:0af4ced868f5 | 15 | */ |
evanso | 8:dd1037c5435b | 16 | |
evanso | 7:0af4ced868f5 | 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 | 8:dd1037c5435b | 26 | /** Initalises GameEngine |
evanso | 8:dd1037c5435b | 27 | * @param lcd object, map object ,spaceship object, |
evanso | 8:dd1037c5435b | 28 | */ |
evanso | 8:dd1037c5435b | 29 | void init(N5110 &lcd, Spaceship &spaceship, Map &map, Gamepad &pad,AnalogIn &adc); |
evanso | 7:0af4ced868f5 | 30 | |
evanso | 8:dd1037c5435b | 31 | /** Main gameplay loop that runs playable part of game |
evanso | 8:dd1037c5435b | 32 | * @param lcd object, map object ,spaceship object, potentiometer object, pad object, potentiometer object |
evanso | 8:dd1037c5435b | 33 | */ |
evanso | 8:dd1037c5435b | 34 | void gameplay_loop(N5110 &lcd, Spaceship &spaceship, Map &map, Gamepad &pad, AnalogIn &pot_1); |
evanso | 7:0af4ced868f5 | 35 | |
evanso | 8:dd1037c5435b | 36 | /** Moves map with spaceship movment |
evanso | 8:dd1037c5435b | 37 | * @param spaceship object, gampad object, |
evanso | 8:dd1037c5435b | 38 | */ |
evanso | 8:dd1037c5435b | 39 | void map_movement(Spaceship &spaceship, Gamepad &pad); |
evanso | 8:dd1037c5435b | 40 | |
evanso | 7:0af4ced868f5 | 41 | private: |
evanso | 8:dd1037c5435b | 42 | int move_map_; |
evanso | 7:0af4ced868f5 | 43 | }; |
evanso | 7:0af4ced868f5 | 44 | |
evanso | 7:0af4ced868f5 | 45 | #endif |