![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
test avoid bulled game
Dependencies: C12832_lcd LCD_fonts mbed mbed-rtos
Converter.cpp@36:b88fa8ff0be9, 2016-12-12 (annotated)
- Committer:
- th_mbed
- Date:
- Mon Dec 12 12:47:07 2016 +0000
- Revision:
- 36:b88fa8ff0be9
- Parent:
- 35:b767ad058a8b
- Child:
- 38:63b99151e218
fix some bugs
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
th_mbed | 23:33d7efd62537 | 1 | #include "convert.h" |
th_mbed | 23:33d7efd62537 | 2 | #include "models.h" |
th_mbed | 23:33d7efd62537 | 3 | #include "point.h" |
pypy_o8o | 25:a08a1f5fbb6a | 4 | #include "C12832_lcd.h" |
th_mbed | 36:b88fa8ff0be9 | 5 | #include <math.h> |
th_mbed | 23:33d7efd62537 | 6 | |
pypy_o8o | 25:a08a1f5fbb6a | 7 | Bitmap Converter::convert(int map[][LCD_X]){ |
th_mbed | 27:afdaee781efa | 8 | int len = LCD_Y*LCD_X/CHAR_SIZE; |
th_mbed | 36:b88fa8ff0be9 | 9 | int count = 0; |
th_mbed | 36:b88fa8ff0be9 | 10 | int tmp = 0; |
th_mbed | 27:afdaee781efa | 11 | char char_map[len]; |
th_mbed | 27:afdaee781efa | 12 | for(int i = 0; i < len; i++ ){ |
th_mbed | 27:afdaee781efa | 13 | char_map[i] = 0; |
th_mbed | 27:afdaee781efa | 14 | } |
th_mbed | 23:33d7efd62537 | 15 | for(int i = 0; i < LCD_Y; i++){ |
th_mbed | 23:33d7efd62537 | 16 | for(int j = 0; j < LCD_X; j++){ |
th_mbed | 36:b88fa8ff0be9 | 17 | int index = (i*LCD_X + j)/CHAR_SIZE; |
th_mbed | 36:b88fa8ff0be9 | 18 | char_map[index] |= map[i][j] << ((CHAR_SIZE - 1) - index % CHAR_SIZE); } |
th_mbed | 23:33d7efd62537 | 19 | } |
th_mbed | 36:b88fa8ff0be9 | 20 | //return char_map; |
pypy_o8o | 25:a08a1f5fbb6a | 21 | Bitmap bitmap_converted = { |
th_mbed | 27:afdaee781efa | 22 | LCD_X, |
th_mbed | 27:afdaee781efa | 23 | LCD_Y, |
th_mbed | 27:afdaee781efa | 24 | LCD_X/CHAR_SIZE, |
th_mbed | 27:afdaee781efa | 25 | char_map, |
th_mbed | 27:afdaee781efa | 26 | }; |
pypy_o8o | 25:a08a1f5fbb6a | 27 | return bitmap_converted; |
pypy_o8o | 25:a08a1f5fbb6a | 28 | } |