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
Diff: main.cpp
- Revision:
- 19:538c93b1b0c8
- Parent:
- 18:71ecb1a428b3
--- a/main.cpp Thu May 09 13:59:41 2019 +0000
+++ b/main.cpp Thu May 09 14:08:12 2019 +0000
@@ -7,7 +7,7 @@
Student ID Number: 201198821
Date: 09/05/2019
*/
-///////// pre-processor directives ////////
+
#include "mbed.h"
#include "Gamepad.h"
#include "N5110.h"
@@ -18,24 +18,17 @@
#define MISSILES_SIZE 2
#define MISSILES_SPEED 3
-/////////////// structs /////////////////
struct UserInput {
Direction d;
float mag;
};
-/////////////// objects ///////////////
+
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
Gamepad pad;
SpaceRebEngine spacerebellion;
-///////////// prototypes ///////////////
- /**
- * @brief Initialises spaceinvader, missiles, lcd and pad
- * @param sets spaceinvader @details Sets height and width of the spaceinvader private variables
- * @param sets missiles @details Sets size and speed of the missiles private variables
- */
- void init();
-
+
+ void init();
void update_game(UserInput input);
void render();
void welcome();
@@ -44,37 +37,13 @@
void Controls();
void Credits();
void Game1Over();
- /**
- * @brief Draws first half of first X
- * @return draw initial first X @details Draws the first half of the first X
- */
void x1_1();
- /**
- * @brief Draws first X
- * @return draw first X @details Draws the complete first X
- */
void x1_2();
- /**
- * @brief Draws first half of second X
- * @return draw initial second X @details Draws the first half of the second X
- */
void x2_1();
- /**
- * @brief Draws second X
- * @return draw second X @details Draws the complete second X
- */
void x2_2();
- /**
- * @brief Draws first half of third X
- * @return draw initial third X @details Draws the first half of the third X
- */
void x3_1();
- /**
- * @brief Draws third X
- * @return draw third X @details Draws the complete third X
- */
void x3_2();
-///////////// gloabal variable ////////////////
+
bool end = false;
int score = 0;
int speed = MISSILES_SPEED;
@@ -124,7 +93,7 @@
{ 0,0,0,0,1,1,1,0,0,0,0 },
{ 0,0,0,0,0,1,0,0,0,0,0 },
};
-///////////// functions ////////////////
+
int main()
{
int fps = 8; // frames per second