/* Filename: UFOImageLoad.cpp * * Author: Br. David Carlson; Br. Isidore Minerd * * Date: July 6, 2009; July 31, 2009 * * Description: This GDK program loads several image files and displays them. * It also loads an MP3 and plays it while the program is executing. * * Images used with permission from: * The Game Creators * (http://www.thegamecreators.com) * and * Mr. Mark Simpson (deviantART pseudoname "PrinzEugn") * (http://prinzeugn.deviantart.com/) * * Music used with permission from: * The Game Creators * (http://www.thegamecreators.com) */ #include "DarkGDK.h" void DarkGDK() { dbSetWindowTitle("Static UFO Invasion Attempt!"); /* Here we load the images from their respective files. First we load the PNG files. These are given their respective identifier numbers. These numbers are used to identify the given image when making other API calls. */ dbLoadImage("Space.png", 1); dbLoadImage("Ship.png",2); /* Two sprites are created for display. The first parameter assigns a sprite ID, the second and third are the x and y coordinates respectively (for display). The final parameter is the number for the image loaded for the given sprite. Note that these do not have to match the sprite ID. */ dbSprite(1, 0, 0, 1); dbSprite(2, 150, 150, 2); /* The image "UFO.png" has a transparent background. The following code shows how you can load a BMP file and set a given color to be transparent. For example, for the file "UFO.bmp" (R,G,B) value (255,0,255) (i.e. bright pink) is to be transparent. The call to dbSetImageColorKey does this for us. */ dbSetImageColorKey(255, 0, 255); dbLoadImage("Ship.bmp", 3); dbSprite(3,250,250,3); /* Here we simply load an MP3 file and set it to play in the background. */ dbLoadMusic("TakeTime.mp3", 1); dbLoopMusic(1); // Wait for the user to pres a key to terminate the program. dbWaitKey(); return; }