test avoid bulled game

Dependencies:   C12832_lcd LCD_fonts mbed mbed-rtos

Files at this revision

API Documentation at this revision

Comitter:
th_mbed
Date:
Mon Dec 12 11:11:01 2016 +0000
Parent:
26:6fe1d95b2b79
Child:
30:f26dcbaa946d
Commit message:
modify Converter

Changed in this revision

Converter.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Converter.cpp	Mon Dec 12 11:00:24 2016 +0000
+++ b/Converter.cpp	Mon Dec 12 11:11:01 2016 +0000
@@ -5,17 +5,21 @@
 #define CHAR_SIZE 8
 
 Bitmap Converter::convert(int map[][LCD_X]){
-    char char_map[LCD_Y*LCD_X/CHAR_SIZE];
+    int len = LCD_Y*LCD_X/CHAR_SIZE;
+    char char_map[len];
+    for(int i = 0; i < len; i++ ){
+        char_map[i] = 0;
+    }
     for(int i = 0; i < LCD_Y; i++){
         for(int j = 0; j < LCD_X; j++){
-            char_map[(i*LCD_X+j)/CHAR_SIZE + 1] |= map[i][j] << ((CHAR_SIZE - 1) - i % CHAR_SIZE);
+            char_map[(i*LCD_X+j)/CHAR_SIZE] |= map[i][j] << ((CHAR_SIZE - 1) - i % CHAR_SIZE);
         }
     }
     Bitmap bitmap_converted = {
-    LCD_X,
-    LCD_Y,
-    LCD_X/CHAR_SIZE,
-    char_map,
-};
+        LCD_X,
+        LCD_Y,
+        LCD_X/CHAR_SIZE,
+        char_map,
+    };
     return bitmap_converted;
 }