C:Drawing Bitmaps with Allegro
From GPWiki
The wiki is now hosted by GameDev.NET at wiki.gamedev.net. All gpwiki.org content has been moved to the new server. However, the GPWiki forums are still active! Come say hello. [edit] Loading and Displaying Bitmaps with AllegroAfter you set_gfx_mode(), BITMAPS usually follow. The way the compiler handles a bitmap is by storing it into a BITMAP variable. You then state what you want to call that bitmap as a pointer. for example... BITMAP *mypicture This stores mypicture as a BITMAP variable. Now all we gotta do is load a bitmap into mypicture. Ensure that the bitmap you want loaded is in the same directory as your program, then load the bitmap into the variable like so. BITMAP *mypicture = load_bitmap("thisismypicture.bmp", NULL); So you have the load_bitmap("",); code. This tells the compiler to load thisismypicture.bmp into mypicture. You don't have to worry about the NULL part. Just make sure you include it in there. so we have our bitmap successfully loaded into a variable. We now have to display it on screen. We do this by using the blit() line. blit(mypicture, screen, 0, 0, 0, 0, 1024, 768); This tells the blit function to display "mypicture", output it to the "screen" the "0"'s are for clipping co-ordinates and the 1024, 768 is just the resolution you used with the set_gfx_mode. And thats about that im afraid. This tutorial may suck but hey. When i came on here there was nothing in this section so until someone posts something more efficient youll just have to make do. Research other functions such as masked_blit() and draw_sprite Hiroki myspace.com/0u73rh34v3n |


