Displaying full-screen images
From GbdevWiki
					Revision as of 20:23, 19 July 2011 by Nitro2k01 (Talk | contribs) (moved Displaying Full-Screen Images to Displaying full-screen images)
Software Needed
Step 1
Open the image you want to be displayed on the GB in the GIMP.

Now we need to make this image an 8 bit pcx file.

Go to Image -> Mode -> Indexed and change the max number of colors to 8.

Resize the image to fit the GB's screen size.

Step 2
Now use this command with the image you saved in the same folder as pcx2gb:
pcx2gb n d *imagenameyousaved*.pcx *tilesfilename*.c *mapfilename*.map
Press enter a few times and your tiles and map files will be generated.
Step 3
Now create your file to actually display the image on the GB.
 
#include <gb/gb.h>
#include "tiles.c"
#include "map.map"
void main()
{
     // Load up the tile data
     set_bkg_data(0,255,tiledata);
     // Switch to VRAM
     VBK_REG = 1;
     // Switch out of VRAM
     VBK_REG = 0;
     // Set screen x,y pos to 0,0 and draw the map 20,18(size of the screen)
     set_bkg_tiles(0,0,20,18,tilemap);
     // Show the background
     SHOW_BKG;
     // Turn the display on
     DISPLAY_ON; 
}
 

