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