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
main.cpp@16:a2c945279b79, 2019-04-24 (annotated)
- Committer:
- el17mcd
- Date:
- Wed Apr 24 13:44:12 2019 +0000
- Revision:
- 16:a2c945279b79
- Parent:
- 15:fa5282fcd134
- Child:
- 17:cb39d9fa08dc
! Player now receives score at the end of the game. leaderboard added in the menus.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| el17mcd | 2:8382613c86a0 | 1 | /* |
| el17mcd | 16:a2c945279b79 | 2 | ELEC2645 Embedded Systems Project: |
| el17mcd | 2:8382613c86a0 | 3 | School of Electronic & Electrical Engineering |
| el17mcd | 2:8382613c86a0 | 4 | University of Leeds |
| el17mcd | 2:8382613c86a0 | 5 | Name: Maxim C. Delacoe |
| el17mcd | 2:8382613c86a0 | 6 | Username: EL 17 MCD |
| el17mcd | 2:8382613c86a0 | 7 | Student ID Number: 2011 58344 |
| el17mcd | 2:8382613c86a0 | 8 | Date: 19/03/2019 |
| el17mcd | 16:a2c945279b79 | 9 | Game: Tanks! |
| el17mcd | 2:8382613c86a0 | 10 | */ |
| el17mcd | 2:8382613c86a0 | 11 | ///////// pre-processor directives //////// |
| el17mcd | 2:8382613c86a0 | 12 | #include "mbed.h" |
| el17mcd | 16:a2c945279b79 | 13 | #include "SDFileSystem.h" |
| el17mcd | 2:8382613c86a0 | 14 | #include "Gamepad.h" |
| el17mcd | 2:8382613c86a0 | 15 | #include "N5110.h" |
| el17mcd | 2:8382613c86a0 | 16 | #include "Bitmap.h" |
| el17mcd | 12:9e6d5d0a0c82 | 17 | #include "Tank.h" |
| el17mcd | 7:a3ccabdebe2e | 18 | #include "TanksEngine.h" |
| el17mcd | 7:a3ccabdebe2e | 19 | #include "Projectile.h" |
| el17mcd | 12:9e6d5d0a0c82 | 20 | #include "Graphics.h" |
| el17mcd | 15:fa5282fcd134 | 21 | #include "Menus.h" |
| el17mcd | 16:a2c945279b79 | 22 | #include "Scores.h" |
| el17mcd | 2:8382613c86a0 | 23 | |
| el17mcd | 7:a3ccabdebe2e | 24 | #ifdef WITH_TESTING |
| el17mcd | 2:8382613c86a0 | 25 | |
| el17mcd | 7:a3ccabdebe2e | 26 | #endif |
| el17mcd | 7:a3ccabdebe2e | 27 | |
| el17mcd | 7:a3ccabdebe2e | 28 | /////////////// objects /////////////// |
| el17mcd | 7:a3ccabdebe2e | 29 | N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); |
| el17mcd | 16:a2c945279b79 | 30 | SDFileSystem sd(PTE3, PTE1, PTE2, PTE4, "sd"); // MOSI, MISO, SCK, CS |
| el17mcd | 16:a2c945279b79 | 31 | Serial serial(USBTX, USBRX); // for PC debug |
| el17mcd | 7:a3ccabdebe2e | 32 | TanksEngine engine; |
| el17mcd | 11:4e2eb64031a0 | 33 | Gamepad pad; |
| el17mcd | 12:9e6d5d0a0c82 | 34 | Graphics graphics; |
| el17mcd | 15:fa5282fcd134 | 35 | Menus menus; |
| el17mcd | 16:a2c945279b79 | 36 | Scores scores; |
| el17mcd | 2:8382613c86a0 | 37 | |
| el17mcd | 2:8382613c86a0 | 38 | int main() |
| el17mcd | 16:a2c945279b79 | 39 | { // need to initialise LCD and Gamepad |
| el17mcd | 2:8382613c86a0 | 40 | lcd.init(); |
| el17mcd | 11:4e2eb64031a0 | 41 | pad.init(); |
| el17mcd | 15:fa5282fcd134 | 42 | |
| el17mcd | 5:8a2e96f7fb4d | 43 | while(1) { // infinite loop |
| el17mcd | 11:4e2eb64031a0 | 44 | |
| el17mcd | 15:fa5282fcd134 | 45 | menus.start_up_screen(graphics, lcd, pad); |
| el17mcd | 16:a2c945279b79 | 46 | menus.main_menu(graphics, lcd, pad, scores); |
| el17mcd | 15:fa5282fcd134 | 47 | engine.initgame(menus); |
| el17mcd | 16:a2c945279b79 | 48 | engine.game_loop(graphics, lcd, pad, menus, scores); |
| el17mcd | 15:fa5282fcd134 | 49 | |
| el17mcd | 8:d4e419dad90f | 50 | } |
| el17mcd | 8:d4e419dad90f | 51 | } |