Message-Id: <199903150108.UAA24445@delorie.com> Comments: Authenticated sender is From: "George Foot" To: "John Carbrey" Date: Mon, 15 Mar 1999 01:06:23 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: Loading a bitmap from a file w/ allegro CC: djgpp AT delorie DOT com X-mailer: Pegasus Mail for Win32 (v2.42a) Reply-To: djgpp AT delorie DOT com I'm afraid there are quite a few problems with your code. I'm not trying to be obnoxious -- it's good to help people -- but when you do you have to make sure the advice you give is correct. Testing sample programs is a good idea. On 14 Mar 99 at 18:10, John Carbrey wrote: > fadeout(1000); Is this meant to be Allegro's `fade_out' function? If so, note that the parameter ranges from 0 to 64, 64 being an immediate change. Passing 1000 is just the same as passing 64. In fact if it is meant to be Allegro's function, the second bitmap will never appear. You also forgot to declare and set the palette, and perhaps should have used two different palettes in case the images used different palettes. Of course if you're not in a 8 bpp mode the palettes aren't relevant and you can ignore this paragraph. Also, you created two 640x480 bitmaps, then loaded two more. The two you created yourself still exist, but are no longer referenced by your code. Functions like `load_bitmap' create their own bitmaps internally -- you don't need to (and shouldn't) do this yourself. How could the function know where the bitmap you created is? Finally, it's a good idea to always check that functions like `create_bitmap' and `load_bitmap' succeed. If they fail, they'll return NULL pointers. You can easily test for this and exit in some appropriate way. If you don't, these NULL pointers will be passed through the rest of your code as if nothing had gone wrong, and eventually (if you're lucky) an error will occur somewhere else in the program. Tracing this back to the original problem can be very awkward. If you're not lucky, you won't find out about the problem until you send the program to someone else and it crashes on their computer. Debugging unreproduceable bugs like these is not fun, and the best thing to do is to avoid creating them. -- George