test avoid bulled game

Dependencies:   C12832_lcd LCD_fonts mbed mbed-rtos

Converter.cpp

Committer:
th_mbed
Date:
2016-12-12
Revision:
36:b88fa8ff0be9
Parent:
35:b767ad058a8b
Child:
38:63b99151e218

File content as of revision 36:b88fa8ff0be9:

#include "convert.h"
#include "models.h"
#include "point.h"
#include "C12832_lcd.h" 
#include <math.h>

Bitmap Converter::convert(int map[][LCD_X]){
    int len = LCD_Y*LCD_X/CHAR_SIZE;
    int count = 0;
    int tmp = 0;
    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++){
            int index = (i*LCD_X + j)/CHAR_SIZE;
            char_map[index] |= map[i][j] << ((CHAR_SIZE - 1) - index % CHAR_SIZE);        }
    }
    //return char_map;
    Bitmap bitmap_converted = {
        LCD_X,
        LCD_Y,
        LCD_X/CHAR_SIZE,
        char_map,
    };
    return bitmap_converted;
}