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:
Tue Dec 13 02:02:50 2016 +0000
Parent:
34:a83cad29890c
Child:
38:63b99151e218
Commit message:
change;

Changed in this revision

Converter.cpp Show annotated file Show diff for this revision Revisions of this file
convert.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/Converter.cpp	Mon Dec 12 11:50:33 2016 +0000
+++ b/Converter.cpp	Tue Dec 13 02:02:50 2016 +0000
@@ -4,7 +4,7 @@
 #include "C12832_lcd.h" 
 #define CHAR_SIZE 8
 
-Bitmap Converter::convert(int map[][LCD_X]){
+char* Converter::convert(int map[][LCD_X]){
     int len = LCD_Y*LCD_X/CHAR_SIZE;
     char char_map[len];
     for(int i = 0; i < len; i++ ){
@@ -21,5 +21,6 @@
         LCD_X/CHAR_SIZE,
         char_map,
     };
-    return bitmap_converted;
+    //return bitmap_converted;
+    return char_map;
 }
--- a/convert.h	Mon Dec 12 11:50:33 2016 +0000
+++ b/convert.h	Tue Dec 13 02:02:50 2016 +0000
@@ -5,7 +5,7 @@
 class Converter
 {
 public:
-    Bitmap convert(int map[][LCD_X]);
+    char* convert(int map[][LCD_X]);
 };
 
 #endif
\ No newline at end of file
--- a/main.cpp	Mon Dec 12 11:50:33 2016 +0000
+++ b/main.cpp	Tue Dec 13 02:02:50 2016 +0000
@@ -41,7 +41,7 @@
     for(int i = 0; i < LCD_Y; i++){
         for(int j = 0; j < LCD_X ; j++){
             if(wall_height[i] > (LCD_Y - 1 - j)){
-                white_board[i][j] = white_board[i][j] ^ 1;
+                white_board[i][j] = 1;
             }
         }
     }
@@ -104,6 +104,8 @@
     int gameOver = 0;
     srand((int)(aIn * 100));
     Converter converter();
+    int len = LCD_Y*LCD_X/8;
+    char char_map[len];
 //    Bitmap picture;
     
     while(true){
@@ -117,10 +119,16 @@
         //printf("bullet  x: %d,  y: %d \n", p_bullet.x,p_bullet.y);
 //        printf("person  x: %d,  y: %d \n", p_person.x,p_person.y);
         corrision_judge(p_person, p_bullet);
-        Bitmap picture = converter.convert(white_board);
+        Bitmap bitmap_converted = {
+             LCD_X,
+             LCD_Y,
+            LCD_X/8,
+            char_map,
+         };
         update_mtx.unlock();
         lcd.cls();
         lcd.print_bm(bitmPlayer,p_person.x,p_person.y);
+        lcd.print_bm(bitmap_converted,0,0);
         if(b != NULL){
             lcd.print_bm(bitmBullet_graphics, p_bullet.x, p_bullet.y);
         }
@@ -128,6 +136,7 @@
         wait(0.02);
         lcd.cls();
         lcd.print_bm(bitmPlayerB,p_person.x,p_person.y);
+        lcd.print_bm(bitmap_converted,0,0);
         if(b != NULL){
             lcd.print_bm(bitmBullet_graphics, p_bullet.x, p_bullet.y);
         }