ELEC2645 (2018/19) / Mbed 2 deprecated el17ph

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
el17ph
Date:
Sun May 12 13:43:27 2019 +0000
Parent:
0:8fb740fa6356
Commit message:
el17ph

Changed in this revision

Maintank/MainTank.cpp Show annotated file Show diff for this revision Revisions of this file
Maintank/MainTank.h Show annotated file Show diff for this revision Revisions of this file
Rocket/Rocket.cpp Show annotated file Show diff for this revision Revisions of this file
Rocket/Rocket.h Show annotated file Show diff for this revision Revisions of this file
TankEngine/TankEngine.cpp Show annotated file Show diff for this revision Revisions of this file
TankEngine/TankEngine.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Maintank/MainTank.cpp	Sat May 11 14:58:43 2019 +0000
+++ b/Maintank/MainTank.cpp	Sun May 12 13:43:27 2019 +0000
@@ -1,11 +1,7 @@
 #include "MainTank.h"
 
 
-/** MainTank Class
-* @brief Set and update the value of tank in the game
-* @author Pengxi Huang
-* @date may,2019
-*/
+
 
 /** Constructor */
 MainTank::MainTank()
--- a/Maintank/MainTank.h	Sat May 11 14:58:43 2019 +0000
+++ b/Maintank/MainTank.h	Sun May 12 13:43:27 2019 +0000
@@ -1,3 +1,4 @@
+///////// pre-processor directives ////////
 #ifndef __MAIN_TANK__
 #define __MAIN_TANK__
 
@@ -5,6 +6,11 @@
 #include "N5110.h"
 #include "Gamepad.h"
 
+/** MainTank Class
+ * @brief Set and update the value of tank in the game
+ * @author Pengxi Huang
+ * @date may,2019
+ */
 
 class MainTank 
 {
--- a/Rocket/Rocket.cpp	Sat May 11 14:58:43 2019 +0000
+++ b/Rocket/Rocket.cpp	Sun May 12 13:43:27 2019 +0000
@@ -1,26 +1,17 @@
 #include "Rocket.h"
 
 
-/** Rocket Class
-* @brief Set and update the value of rocket in the game
-* @author Pengxi Huang
-* @date may,2019
-*/
-
-/** Constructor */
 Rocket::Rocket()
 {
     
 }
-/** Destructor */
+
 Rocket::~Rocket()
 {
     
 }
 
-/** Inital the postion
- * @param the X and y of the class(int)
- */
+
 //init the postion of the rocket
 void Rocket::init()
 {
@@ -47,18 +38,14 @@
 }
 
 
-/** Set the new position
- * @param the value of the new position(Vector2D)
- */
+
 //update its y position base on speed
 void Rocket::update()
 {
     m_y += m_speed;
 }
 
-/** Get the position of rocket 1
- * @return the current poition in 2d
- */
+
 //get the x and y value for rocket 1
 Vector2D Rocket::get_pos1()
 {
@@ -66,9 +53,7 @@
     return p1;
 }
 
-/** Get the position of rocket 2
- * @return the current poition in 2d
- */
+
 //get the x and y value for rocket 2
 Vector2D Rocket::get_pos2()
 {
--- a/Rocket/Rocket.h	Sat May 11 14:58:43 2019 +0000
+++ b/Rocket/Rocket.h	Sun May 12 13:43:27 2019 +0000
@@ -5,16 +5,35 @@
 #include "N5110.h"
 #include "Gamepad.h"
 
+/** Rocket Class
+* @brief Set and update the value of rocket in the game
+* @author Pengxi Huang
+* @date may,2019
+*/
+
 class Rocket
 {
 public:
+    /** Constructor */
     Rocket();
+    /** Destructor */
     ~Rocket();
+    /** Inital the postion
+     * @param the X and y of the class(int)
+     */
     void init();
     void draw(N5110 &lcd);
+    /** Set the new position
+     * @param the value of the new position(Vector2D)
+     */
     void update();
-    /// accessors and mutators
+    /** Get the position of rocket 1
+     * @return the current poition in 2d
+     */
     Vector2D get_pos1();
+    /** Get the position of rocket 2
+     * @return the current poition in 2d
+     */
     Vector2D get_pos2();
 private:
     int m_speed;
--- a/TankEngine/TankEngine.cpp	Sat May 11 14:58:43 2019 +0000
+++ b/TankEngine/TankEngine.cpp	Sun May 12 13:43:27 2019 +0000
@@ -1,26 +1,18 @@
 #include "TankEngine.h"
 
 
-/** TankEngine Class
-* @brief Set and update the engine of game(include rocket and tank)
-* @author Pengxi Huang
-* @date may,2019
-*/
 
-/** Constructor */
+
 TankEngine::TankEngine()
 {
 
 }
-/** Destructor */
+
 TankEngine::~TankEngine()
 {
 
 }
 
-/** Inital the every value
- * @param the all value of the class(int)
- */
 //init value of tank and rocket
 void TankEngine::init()
 {
@@ -28,9 +20,7 @@
     _r.init();
 }
 
-/** Set the Value of direction and magnitude
- * @param the value of the new position(Vector2D)
- */
+
 //get the input value from gamepad
 void TankEngine::read_input(Gamepad &pad)
 {
@@ -38,9 +28,7 @@
     _mag = pad.get_mag();//read joystick movement
 }
 
-/** Set the new position and do collaps detect
- * @param the value of the new position(Vector2D)
- */
+
 //update the status of tank and rocket
 void TankEngine::update(Gamepad &pad)
 { 
@@ -189,9 +177,6 @@
     
 }
 
-/** Get the score
- * @return the current score
- */
 //Get the value of score
 int TankEngine::hello_score()
 {
@@ -199,9 +184,6 @@
     return score;
 }
 
-/** Get the life
- * @return the current life
- */
 //Get the value of life
 int TankEngine::get_life()
 {
--- a/TankEngine/TankEngine.h	Sat May 11 14:58:43 2019 +0000
+++ b/TankEngine/TankEngine.h	Sun May 12 13:43:27 2019 +0000
@@ -7,18 +7,39 @@
 #include "MainTank.h"
 #include "Rocket.h" 
 
+/** TankEngine Class
+ * @brief Set and update the engine of game(include rocket and tank)
+ * @author Pengxi Huang
+ * @date may,2019
+ */
 class TankEngine
 {
 public:
-
+    /** Constructor */
     TankEngine();
+    /** Destructor */
     ~TankEngine();
-    
+    /** Inital the every value
+     * @param the all value of the class(int)
+     */
     void init();
+    /** Set the Value of direction and magnitude
+     * @param the value of the new position(Vector2D)
+     */
     void read_input(Gamepad &pad);
+    /** Set the new position and do collaps detect
+     * @param the value of the new position(Vector2D)
+     */
     void update(Gamepad &pad);
+    /// accessors and mutators
     void Draw(N5110 &lcd);
+    /** Get the life
+     * @return the current life
+     */
     int get_life();
+    /** Get the score
+     * @return the current score
+     */
     int hello_score();
 private:
 
--- a/main.cpp	Sat May 11 14:58:43 2019 +0000
+++ b/main.cpp	Sun May 12 13:43:27 2019 +0000
@@ -14,11 +14,13 @@
 Date:11.05.2019
 */
 
+/////////////// structs /////////////////
 struct UserInput {
     Direction d;
     float mag;
 };
 
+///////////// prototypes ///////////////
 void init();
 void update_game(UserInput input);
 void render();
@@ -27,9 +29,11 @@
 void print_level();
 int quite();
 
+/////////////// objects ///////////////
 N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);  
 Gamepad pad;
 TankEngine Tank;
+///////////// functions ////////////////
 //main function
 int main()
 {