Simplified Doodle Jump game for mbed
Dependencies: 4DGL-uLCD-SE LSM9DS1_Library_cal SDFileSystem mbed-rtos mbed wave_player
myBMP/myBMP.h@3:141c57be5a2d, 2016-03-15 (annotated)
- Committer:
- bhill42
- Date:
- Tue Mar 15 02:34:14 2016 +0000
- Revision:
- 3:141c57be5a2d
- Parent:
- 1:bdeb188cb474
Final
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bhill42 | 1:bdeb188cb474 | 1 | // Code taken and hacked from EasyBMP library by Paul Macklin |
bhill42 | 1:bdeb188cb474 | 2 | |
bhill42 | 1:bdeb188cb474 | 3 | #include "uLCD_4DGL.h" |
bhill42 | 1:bdeb188cb474 | 4 | #include "SDFileSystem.h" |
bhill42 | 1:bdeb188cb474 | 5 | |
bhill42 | 1:bdeb188cb474 | 6 | #define DefaultXPelsPerMeter 3780 |
bhill42 | 1:bdeb188cb474 | 7 | #define DefaultYPelsPerMeter 3780 |
bhill42 | 1:bdeb188cb474 | 8 | |
bhill42 | 1:bdeb188cb474 | 9 | typedef unsigned char ebmpBYTE; |
bhill42 | 1:bdeb188cb474 | 10 | typedef unsigned short ebmpWORD; |
bhill42 | 1:bdeb188cb474 | 11 | typedef unsigned int ebmpDWORD; |
bhill42 | 1:bdeb188cb474 | 12 | |
bhill42 | 1:bdeb188cb474 | 13 | typedef struct RGBApixel { |
bhill42 | 1:bdeb188cb474 | 14 | ebmpBYTE Blue; |
bhill42 | 1:bdeb188cb474 | 15 | ebmpBYTE Green; |
bhill42 | 1:bdeb188cb474 | 16 | ebmpBYTE Red; |
bhill42 | 1:bdeb188cb474 | 17 | ebmpBYTE Alpha; |
bhill42 | 1:bdeb188cb474 | 18 | } RGBApixel; |
bhill42 | 1:bdeb188cb474 | 19 | |
bhill42 | 1:bdeb188cb474 | 20 | typedef struct RGBpixel { |
bhill42 | 1:bdeb188cb474 | 21 | ebmpBYTE Blue; |
bhill42 | 1:bdeb188cb474 | 22 | ebmpBYTE Green; |
bhill42 | 1:bdeb188cb474 | 23 | ebmpBYTE Red; |
bhill42 | 1:bdeb188cb474 | 24 | } RGBpixel; |
bhill42 | 1:bdeb188cb474 | 25 | |
bhill42 | 1:bdeb188cb474 | 26 | |
bhill42 | 1:bdeb188cb474 | 27 | class BMFH{ |
bhill42 | 1:bdeb188cb474 | 28 | public: |
bhill42 | 1:bdeb188cb474 | 29 | ebmpWORD bfType; |
bhill42 | 1:bdeb188cb474 | 30 | ebmpDWORD bfSize; |
bhill42 | 1:bdeb188cb474 | 31 | ebmpWORD bfReserved1; |
bhill42 | 1:bdeb188cb474 | 32 | ebmpWORD bfReserved2; |
bhill42 | 1:bdeb188cb474 | 33 | ebmpDWORD bfOffBits; |
bhill42 | 1:bdeb188cb474 | 34 | |
bhill42 | 1:bdeb188cb474 | 35 | BMFH(); |
bhill42 | 1:bdeb188cb474 | 36 | }; |
bhill42 | 1:bdeb188cb474 | 37 | |
bhill42 | 1:bdeb188cb474 | 38 | class BMIH{ |
bhill42 | 1:bdeb188cb474 | 39 | public: |
bhill42 | 1:bdeb188cb474 | 40 | ebmpDWORD biSize; |
bhill42 | 1:bdeb188cb474 | 41 | ebmpDWORD biWidth; |
bhill42 | 1:bdeb188cb474 | 42 | ebmpDWORD biHeight; |
bhill42 | 1:bdeb188cb474 | 43 | ebmpWORD biPlanes; |
bhill42 | 1:bdeb188cb474 | 44 | ebmpWORD biBitCount; |
bhill42 | 1:bdeb188cb474 | 45 | ebmpDWORD biCompression; |
bhill42 | 1:bdeb188cb474 | 46 | ebmpDWORD biSizeImage; |
bhill42 | 1:bdeb188cb474 | 47 | ebmpDWORD biXPelsPerMeter; |
bhill42 | 1:bdeb188cb474 | 48 | ebmpDWORD biYPelsPerMeter; |
bhill42 | 1:bdeb188cb474 | 49 | ebmpDWORD biClrUsed; |
bhill42 | 1:bdeb188cb474 | 50 | ebmpDWORD biClrImportant; |
bhill42 | 1:bdeb188cb474 | 51 | |
bhill42 | 1:bdeb188cb474 | 52 | BMIH(); |
bhill42 | 1:bdeb188cb474 | 53 | }; |
bhill42 | 1:bdeb188cb474 | 54 | bool ReadBMPFromFile( const char* FileName , RGBApixel *Colors, uLCD_4DGL *lcd); |
bhill42 | 1:bdeb188cb474 | 55 | bool ReadBMPFromFile(const char* FileName , RGBApixel *Colors, uLCD_4DGL *lcd, int x, int y); |
bhill42 | 3:141c57be5a2d | 56 | // need to allocate width*height ints for color_array |
bhill42 | 3:141c57be5a2d | 57 | // colors go from color_array[0] to color_array[width*height-1] going from i,j coord values |
bhill42 | 3:141c57be5a2d | 58 | // accessed with color_array[width*j + i] |
bhill42 | 3:141c57be5a2d | 59 | bool ReadColorsFromFile(const char* FileName , RGBApixel *Colors, int * color_array, int x, int y); |
bhill42 | 3:141c57be5a2d | 60 | void DrawColorstoLCD(int * color_array, uLCD_4DGL *lcd, int x, int y, int w, int h); |