test avoid bulled game
Dependencies: C12832_lcd LCD_fonts mbed mbed-rtos
Converter.cpp@30:f26dcbaa946d, 2016-12-12 (annotated)
- Committer:
- kaku_jyoko
- Date:
- Mon Dec 12 11:17:22 2016 +0000
- Revision:
- 30:f26dcbaa946d
- Parent:
- 27:afdaee781efa
- Child:
- 35:b767ad058a8b
- Child:
- 37:f5d98f22b6bd
change
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 | 23:33d7efd62537 | 5 | #define CHAR_SIZE 8 |
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 | 27:afdaee781efa | 9 | char char_map[len]; |
th_mbed | 27:afdaee781efa | 10 | for(int i = 0; i < len; i++ ){ |
th_mbed | 27:afdaee781efa | 11 | char_map[i] = 0; |
th_mbed | 27:afdaee781efa | 12 | } |
th_mbed | 23:33d7efd62537 | 13 | for(int i = 0; i < LCD_Y; i++){ |
th_mbed | 23:33d7efd62537 | 14 | for(int j = 0; j < LCD_X; j++){ |
th_mbed | 27:afdaee781efa | 15 | char_map[(i*LCD_X+j)/CHAR_SIZE] |= map[i][j] << ((CHAR_SIZE - 1) - i % CHAR_SIZE); |
th_mbed | 23:33d7efd62537 | 16 | } |
th_mbed | 23:33d7efd62537 | 17 | } |
pypy_o8o | 25:a08a1f5fbb6a | 18 | Bitmap bitmap_converted = { |
th_mbed | 27:afdaee781efa | 19 | LCD_X, |
th_mbed | 27:afdaee781efa | 20 | LCD_Y, |
th_mbed | 27:afdaee781efa | 21 | LCD_X/CHAR_SIZE, |
th_mbed | 27:afdaee781efa | 22 | char_map, |
th_mbed | 27:afdaee781efa | 23 | }; |
pypy_o8o | 25:a08a1f5fbb6a | 24 | return bitmap_converted; |
pypy_o8o | 25:a08a1f5fbb6a | 25 | } |