Message-ID: From: Shawn Hargreaves To: djgpp AT delorie DOT com Subject: Re: Error blitting to bitmap Date: Wed, 27 Oct 1999 12:08:08 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="ISO-8859-1" Reply-To: djgpp AT delorie DOT com Lasse Hassing writes: > int main() { > FlukkiB = load_pcx("flukki.pcx", MyPal); > generate_optimized_palette(FlukkiB, MyPal, NULL); [snip] > // init Allegro!! > allegro_init(); You have a nasty order of processing problem here: it is not a good idea to be calling Allegro functions before you've initialised Allegro! In fact, the docs explain that you must also set a graphics mode before you try to load in any truecolor images, like you are doing here. > // Set GFX driver > set_gfx_mode(GFX_AUTODETECT, 320, 240, 320, 240); > // Set color depth > set_color_depth(32); Another order of processing error: set_gfx_mode() uses the current color depth, so you must set the color depth before you call it, rather than just after (what you are doing here has no effect). > // Set active palete > set_pallete(MyPal); Not a bug, but there is no reason to use any palette stuff (or to bother with the previous palette generation) since your program is running in a truecolor mode. > install_int(BlitTimer, 1000); [snip] > void BlitTimer(void) > { > DoBlit(); > } > END_OF_FUNCTION(BlitTimer); This is a very bad idea: you are calling lots of complex functions from inside a timer handler, and haven't locked either the code or any of the data that this code is using. Since much of this code and data is buried down inside Allegro, it probably isn't even possible for you to lock it, so the simple fix is not to do this. Keep your timer handlers simple, just setting a few flags, and do all your real work like graphics drawing from the mainline program code. Shawn Hargreaves.