bird

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
1013373474
Date:
Mon May 06 05:02:25 2019 +0000
Parent:
5:6be8521a885a
Commit message:
change the class name of structure_2.h file

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
structure_2/structure2.cpp Show annotated file Show diff for this revision Revisions of this file
structure_2/structure2.h Show annotated file Show diff for this revision Revisions of this file
structure_2/structure_2.cpp Show diff for this revision Revisions of this file
structure_2/structure_2.h Show diff for this revision Revisions of this file
diff -r 6be8521a885a -r 9bf0273ee25f main.cpp
--- a/main.cpp	Mon May 06 04:55:51 2019 +0000
+++ b/main.cpp	Mon May 06 05:02:25 2019 +0000
@@ -1,6 +1,6 @@
 
 #include "structure.h"
-#include "structure_2.h"
+#include "structure2.h"
 
 void init();
 void welcome();
@@ -17,7 +17,7 @@
 Gamepad pad;
 bird bird;
 structure structure;
-structure_2 structure_2;
+structure2 structure_2;
 
 
 
diff -r 6be8521a885a -r 9bf0273ee25f structure_2/structure2.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/structure_2/structure2.cpp	Mon May 06 05:02:25 2019 +0000
@@ -0,0 +1,100 @@
+#include "structure2.h"
+
+void structure2::init(){
+    _mm = 41;
+    _pp = 71;
+    _ee = 101;
+    _nn = 12;
+    _qq = 19;
+    _oo = 17;    
+    _tt = 0;
+    }
+
+void structure2::draw(N5110 &lcd)
+{    
+    
+   
+    _nn = rand() % (20-5+1)+ 5;
+    
+  
+    _qq = rand() % (20-5+1)+ 5;
+    
+
+    _oo = rand() % (20-5+1)+ 5;
+    
+    
+
+    
+    lcd.drawRect(_mm,_nn+15,5,33-_nn,FILL_BLACK);//该公式前两个点是坐标,后两个点是涂抹区域的长宽,先长后宽,障碍物中间的间隔是10
+    lcd.drawRect(_mm,0,5,_nn,FILL_BLACK);//the higher
+    
+    lcd.drawRect(_pp,0,5,_qq,FILL_BLACK);
+    lcd.drawRect(_pp,_qq+15,5,33-_qq,FILL_BLACK);
+    
+    lcd.drawRect(_ee,0,5,_oo,FILL_BLACK);
+    lcd.drawRect(_ee,_oo+15,5,33-_oo,FILL_BLACK);    
+    lcd.refresh();
+    
+    
+    
+    _mm -= 2;
+    _pp -= 2;
+    _ee -= 2;
+  
+    
+    if ( _mm == 1 ){
+        _mm = _ee + 30;
+        }
+    if ( _pp == 1 ){
+        _pp = _mm + 30;
+        }
+    if ( _ee == 1 ){
+        _ee = _pp + 30;
+        }                    //xun huan
+        
+        
+        
+    if ( _mm == 31 ){
+        _tt = _tt++;
+        }
+    if ( _pp == 31 ){
+        _tt = _tt++;
+        }
+    if ( _ee == 31 ){
+        _tt = _tt++;
+        }
+    if ( _mm <= 15 ){
+        _nn =0 ;
+        }    
+        if ( _pp <= 15 ){
+        _qq =0 ;
+        }    
+         if ( _ee <= 15 ){
+        _oo =0 ;
+        }    
+        
+        
+}
+
+
+
+
+
+Data2 structure2::get_data2()
+{
+    _data2.mm = _mm;
+    _data2.pp = _pp;
+    _data2.ee = _ee;
+    _data2.nn = _nn;
+    _data2.qq = _qq;
+    _data2.oo = _oo;
+    _data2.tt = _tt; // 分数
+    return _data2;
+}
+
+
+
+
+
+
+
diff -r 6be8521a885a -r 9bf0273ee25f structure_2/structure2.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/structure_2/structure2.h	Mon May 06 05:02:25 2019 +0000
@@ -0,0 +1,56 @@
+#include "mbed.h"
+#include "N5110.h"
+#include "Gamepad.h"
+
+/**
+*@brief Data struct includes the structure position.
+*/
+
+struct Data2{
+    int mm; /**<int the position of the first structure */
+    int nn; /**<int the position of the first channel */
+    int qq; /**<int the position of the second structure */
+    int oo; /**<int the position of the second channel */
+    int pp; /**<int the position of the third structure */
+    int ee; /**<int the position of the third channel */
+    int tt;/**<int the position of the third channel */
+    };
+/** structure2 Class
+*@brief Data used to make the structure
+*@author Zhou Yongzhi
+*@date May 2019
+*/   
+class structure2
+{
+public:
+     /**
+   *@brief initialise the parameters
+   *@param size,speed
+   */
+   void init(int size,int speed);
+   /**
+   *@brief initialise the parameters
+   *@param lcd
+   *@details The function in N5110 is used
+   */
+   void draw(N5110 &lcd);
+   /**
+   *@brief initialise the parameters
+   */
+   void init();
+        /**
+   *@brief The data which are sent to main.cpp
+   */
+   Data2 get_data2();
+
+    
+private:
+  int _mm; //障碍物左上角的点的横坐标
+  int _nn; // 障碍物间隔左上角点的纵坐标
+  int _qq; //the second
+  int _oo; // the third
+  int _pp; // the second  heng zuobiao
+  int _ee; // the third  heng zuobiao
+  int _tt; // the score
+  Data2 _data2;
+};
\ No newline at end of file
diff -r 6be8521a885a -r 9bf0273ee25f structure_2/structure_2.cpp
--- a/structure_2/structure_2.cpp	Mon May 06 04:55:51 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-#include "structure_2.h"
-
-void structure_2::init(){
-    _mm = 41;
-    _pp = 71;
-    _ee = 101;
-    _nn = 12;
-    _qq = 19;
-    _oo = 17;    
-    _tt = 0;
-    }
-
-void structure_2::draw(N5110 &lcd)
-{    
-    
-   
-    _nn = rand() % (20-5+1)+ 5;
-    
-  
-    _qq = rand() % (20-5+1)+ 5;
-    
-
-    _oo = rand() % (20-5+1)+ 5;
-    
-    
-
-    
-    lcd.drawRect(_mm,_nn+15,5,33-_nn,FILL_BLACK);//该公式前两个点是坐标,后两个点是涂抹区域的长宽,先长后宽,障碍物中间的间隔是10
-    lcd.drawRect(_mm,0,5,_nn,FILL_BLACK);//the higher
-    
-    lcd.drawRect(_pp,0,5,_qq,FILL_BLACK);
-    lcd.drawRect(_pp,_qq+15,5,33-_qq,FILL_BLACK);
-    
-    lcd.drawRect(_ee,0,5,_oo,FILL_BLACK);
-    lcd.drawRect(_ee,_oo+15,5,33-_oo,FILL_BLACK);    
-    lcd.refresh();
-    
-    
-    
-    _mm -= 2;
-    _pp -= 2;
-    _ee -= 2;
-  
-    
-    if ( _mm == 1 ){
-        _mm = _ee + 30;
-        }
-    if ( _pp == 1 ){
-        _pp = _mm + 30;
-        }
-    if ( _ee == 1 ){
-        _ee = _pp + 30;
-        }                    //xun huan
-        
-        
-        
-    if ( _mm == 31 ){
-        _tt = _tt++;
-        }
-    if ( _pp == 31 ){
-        _tt = _tt++;
-        }
-    if ( _ee == 31 ){
-        _tt = _tt++;
-        }
-    if ( _mm <= 15 ){
-        _nn =0 ;
-        }    
-        if ( _pp <= 15 ){
-        _qq =0 ;
-        }    
-         if ( _ee <= 15 ){
-        _oo =0 ;
-        }    
-        
-        
-}
-
-
-
-
-
-Data2 structure_2::get_data2()
-{
-    _data2.mm = _mm;
-    _data2.pp = _pp;
-    _data2.ee = _ee;
-    _data2.nn = _nn;
-    _data2.qq = _qq;
-    _data2.oo = _oo;
-    _data2.tt = _tt; // 分数
-    return _data2;
-}
-
-
-
-
-
-
-
diff -r 6be8521a885a -r 9bf0273ee25f structure_2/structure_2.h
--- a/structure_2/structure_2.h	Mon May 06 04:55:51 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-#include "mbed.h"
-#include "N5110.h"
-#include "Gamepad.h"
-
-/**
-*@brief Data struct includes the structure position.
-*/
-
-struct Data2{
-    int mm; /**<int the position of the first structure */
-    int nn; /**<int the position of the first channel */
-    int qq; /**<int the position of the second structure */
-    int oo; /**<int the position of the second channel */
-    int pp; /**<int the position of the third structure */
-    int ee; /**<int the position of the third channel */
-    int tt;/**<int the position of the third channel */
-    };
-/** structure2 Class
-*@brief Data used to make the structure
-*@author Zhou Yongzhi
-*@date May 2019
-*/   
-class structure_2
-{
-public:
-     /**
-   *@brief initialise the parameters
-   *@param size,speed
-   */
-   void init(int size,int speed);
-   /**
-   *@brief initialise the parameters
-   *@param lcd
-   *@details The function in N5110 is used
-   */
-   void draw(N5110 &lcd);
-   /**
-   *@brief initialise the parameters
-   */
-   void init();
-        /**
-   *@brief The data which are sent to main.cpp
-   */
-   Data2 get_data2();
-
-    
-private:
-  int _mm; //障碍物左上角的点的横坐标
-  int _nn; // 障碍物间隔左上角点的纵坐标
-  int _qq; //the second
-  int _oo; // the third
-  int _pp; // the second  heng zuobiao
-  int _ee; // the third  heng zuobiao
-  int _tt; // the score
-  Data2 _data2;
-};
\ No newline at end of file