From: "Gautam N. Lad" Newsgroups: comp.os.msdos.djgpp Subject: Allegro won't display more than 1 PCX (properly)!!! Date: 25 Jan 1997 22:25:01 GMT Organization: InterLog Internet Services Lines: 71 Message-ID: <5ce17t$68h@news.interlog.com> NNTP-Posting-Host: ip220-189.cc.interlog.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Hi, Ok, since I don't know how to display PCX images, I had to resort to Allegro (which I think is amazing, and I look forward to the new version which includes some 3D goodies!!). I modified the example EX15.C source to display two different PCXs. So, here's the code. Now what I don't understand is why does Allegro use one palette to display an image, and when another palette is created for another image, that original palette gets screwed up, and starts using the palette from the new palette. Are ya confused? Look at the source; it might be easier. In this program, two PCX images are loaded (I could've used a for loop, but I wanted to make sure it works. Oh well.) /*------------------------------------------------------------------*/ #include #include #include "allegro.h" void main() { /* Create an array for the bitmaps and the palette. */ BITMAP *the_image[2]; PALLETE the_pallete[2]; /* Load the image and store the palette in the the_pallete array */ the_image[0] = load_bitmap("PREVUES.PCX", the_pallete[0]); the_image[1] = load_bitmap("PREVUES2.PCX", the_pallete[1]); /* Init. some stuff. */ allegro_init(); install_keyboard(); set_gfx_mode(GFX_AUTODETECT, 800, 600, 0, 0); /* Set palette for first image, and display it. */ set_pallete(the_pallete[0]); blit(the_image[0], screen, 0, 0,10,10,160,120); destroy_bitmap(the_image[0]); /* Set palette for secnod image, and display it. But, when they get displayed, the second image looks fine; it's the 1st image's palette that screws up. It starts using the second image's palette. */ set_pallete(the_pallete[1]); blit(the_image[1], screen, 0, 0,300,10,160,120); destroy_bitmap(the_image[1]); readkey(); exit(0); } /*------------------------------------------------------------------*/ Please help. Is this possible, or am I hopeless! ;( Bye! **************************************************** * Gautam N. Lad * *--------------------------------------------------* * * * E-Mail : gautam AT interlog DOT com * * Website : http://www.interlog.com/~gautam * * * * OS/2, DOS/Windows, Graphics Gallery, Software, * * Links, Rayzor Editor/2, POV-Ray, and more. * ****************************************************