test avoid bulled game

Dependencies:   C12832_lcd LCD_fonts mbed mbed-rtos

Files at this revision

API Documentation at this revision

Comitter:
kaku_jyoko
Date:
Fri Dec 02 07:35:34 2016 +0000
Parent:
3:e74b63412b10
Child:
5:651879f4f047
Commit message:
thread

Changed in this revision

Bullet.cpp Show annotated file Show diff for this revision Revisions of this file
Person.cpp 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
mbed-rtos.lib Show annotated file Show diff for this revision Revisions of this file
models.h Show annotated file Show diff for this revision Revisions of this file
point.h Show annotated file Show diff for this revision Revisions of this file
--- a/Bullet.cpp	Fri Dec 02 06:23:48 2016 +0000
+++ b/Bullet.cpp	Fri Dec 02 07:35:34 2016 +0000
@@ -1,5 +1,5 @@
-#include<point.h>
-#include<models.h>
+#include "point.h"
+#include "models.h"
 
 Bullet::Bullet(point p, int v){
     this->p = p;
--- a/Person.cpp	Fri Dec 02 06:23:48 2016 +0000
+++ b/Person.cpp	Fri Dec 02 07:35:34 2016 +0000
@@ -1,8 +1,9 @@
-#include<point.h>
-#include<models.h>
+#include "point.h"
+#include "models.h"
 
 Person::Person(){
-    p = {DEFAULT_X, DEFAULT_Y};
+    p.x = DEFAULT_X;
+    p.y = DEFAULT_Y;
     jump_count = 0;
     jump_time = 0;
 }
--- a/main.cpp	Fri Dec 02 06:23:48 2016 +0000
+++ b/main.cpp	Fri Dec 02 07:35:34 2016 +0000
@@ -3,21 +3,38 @@
 #include "Arial_9.h"
 #include "Small_7.h"
 #include "graphics.h"
+#include "models.h"
+#include "rtos.h"
+
 
 C12832_LCD lcd;
 
+// down: p12, left: p13, center: p14, up: p15, right: p16
+DigitalIn button(p14);
+
+int jump_flag = 0;
+
+//int main(){
+//    lcd.cls();
+//    lcd.set_font((unsigned char*) Arial_9);
+//    while(1){
+//        lcd.print_bm(bitmPerson,2,32-6);
+//        lcd.copy_to_lcd();
+//        wait(0.5);
+//        lcd.print_bm(bitmPersonB,2,32-6);
+//        lcd.copy_to_lcd();
+//        wait(0.5);
+//    }
+//}
+
 int main(){
-    lcd.cls();
-    lcd.set_font((unsigned char*) Arial_9);
-    //lcd.print_bm(bitmPerson,95,0);  // print chistmas tree
-   // lcd.copy_to_lcd(); 
-    while(1){
-        lcd.print_bm(bitmPerson,2,32-6);
-        lcd.copy_to_lcd();
-        wait(0.5);
-        lcd.print_bm(bitmPersonB,2,32-6);
-        lcd.copy_to_lcd();
-        wait(0.5);
+    Thread receive_th(receive);
+}
+
+void receive(void const *argument){
+    while(true){
+        if(button){
+            jump_flag = 1;
+        }
     }
-    return 0;
 }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-rtos.lib	Fri Dec 02 07:35:34 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed-rtos/#58563e6cba1e
--- a/models.h	Fri Dec 02 06:23:48 2016 +0000
+++ b/models.h	Fri Dec 02 07:35:34 2016 +0000
@@ -1,3 +1,4 @@
+#include "point.h"
 #ifndef models_h
 #define models_h
 
--- a/point.h	Fri Dec 02 06:23:48 2016 +0000
+++ b/point.h	Fri Dec 02 07:35:34 2016 +0000
@@ -1,10 +1,11 @@
 #ifndef point_h
 #define point_h
 
-#define BOARD_X = 128
-#define BOARD_Y = 32
+#define BOARD_X 128
+#define BOARD_Y 32
 
 typedef struct {
     int x;
     int y;
-} point;
\ No newline at end of file
+} point;
+#endif
\ No newline at end of file