User interfaces and games can be made much more interesting using color graphics. The GLCD library includes a function called GLCD_DrawBitmap()
that can be used to render 16-bit color bitmaps. Bitmaps can be designed using standard editors or downloaded from elsewhere. The following recipe shows you how to generate a simple bitmapped representation of a ball that can be used with the helloBounce and helloPong recipes we developed in Chapter 2, C Language Programming. We'll call this recipe bitmapBounce_c6v0
.
To design bitmapped graphics, follow these instructions:
Create a color bitmap of width 16 pixels and height 24 pixels using the Windows Paint application. A screenshot of what this should look like is displayed, as follows:
Save the ball icon as a standard 24-bit bitmap, with the filename as
ball.bmp
.Use GIMP (http://www.gimp.org) to convert the 24-bit-per-pixel bitmap to a 16-bit-per-pixel format and store the pixel values in an array. First install...