Reply-To: From: "Arthur" To: "DJGPP Mailing List" Subject: RE: Retrieving BMP from datafile? Date: Mon, 31 Aug 1998 11:09:46 +0100 Message-ID: <000101bdd4c7$7affb240$c64b08c3@arthur> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Importance: Normal In-Reply-To: <35E9C548.5F8D@cableol.co.uk> Precedence: bulk > > I've almost finished a Othello clone, with the help of the allegro > > library, and want to place all the graphics into a dat file before > > releasing it for testing among friends and family. > > > > I have found out to make the dat file with the grabber program. > > but I can't figure out how to get the BMP files out of the dat file > > again. > > > > I have a othello.h header file (created with the grabber). > > and a BMP file called 'backgr' (inside the dat file). > > and finally a palette called 'othello' (also inside the dat file). > > > > Could anyone please help me with a small example on how to retrieve the > > BMP drawing from the dat file?? > > > > Thanks in advance. > > Einar. > > > > ------------------------------------------------------- > > > > Remove [EINAR] from e-mail address when replying > > Try looking allegro examples, as I am sure they have an example of it > some where. Nothing really explanatory. First build your datafile. There's a program in the tools directory called dat.exe, and it had an option to export a .h file (using the -h switch). When you've created a header file for your datafile, #include that into your code (the datafile contains a list of the items in the datafile). Then create a pointer to a DATAFILE structure in your code: DATAFILE *file; then load in your datafile: file = load_datafile("data.dat"); Now to extract a BITMAP: BITMAP *image; image = (BITMAP *) file[MY_IMAGE_FILE].dat; MY_IMAGE_FILE is whatever you called the image in the datafile (handily defined in that header file you created). And the (BITMAP *) is obviously a cast. As far as I can tell, you don't need to destroy a BITMAP after use, just the datafile. HTH James Arthur jaa AT arfa DOT clara DOT net ICQ#15054819