Message-ID: <37B6E6DF.83E@ns.sympatico.ca> From: Klaas Organization: N/A X-Mailer: Mozilla 3.04 (Win95; I) MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: Problems with allegro References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 56 Date: Sun, 15 Aug 1999 13:12:15 -0300 NNTP-Posting-Host: 142.177.98.89 X-Trace: sapphire.mtt.net 934733517 142.177.98.89 (Sun, 15 Aug 1999 13:11:57 ADT) NNTP-Posting-Date: Sun, 15 Aug 1999 13:11:57 ADT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Al Morgan wrote: > > I've gotten some basic stuff to work using allegro, Mode-X graphics (i still > haven't gotten that to work without using a 3rd party library, grrr...) , > keyboard, mouse, and I've been able to load bitmaps and draw them on the > screen. The problem is when I tried to set the palette, beacuse my picture > was turning out all wrong colors, but when I did, it gave an error (copied > below my program). Is it me, or is it my computer that has a problem? > > #include > #include > > void main() > { > allegro_init(); > install_keyboard(); > install_mouse(); > > set_gfx_mode(GFX_MODEX, 320, 240, 320, 480); > > PALETTE *p; It's usually easier to not use pointers with palletes in Allegro. > BITMAP *belive = load_bmp("c:\\belive.bmp", *p); // mulder's "I want to > belive" poster For example, here you are passing trash from an uninitialized pointer to load_bmp, intead of a pointer variable. Just do this: PALLETE pal; BITMAP *bmp=load_bmp("bmp.bmp",pal); > set_palette(*p); // HERE'S WHERE THE PROBLEM IS set_pallete(pal); > > draw_sprite(screen, belive, 0, 0); > > getch(); > > destroy_bitmap(belive); > allegro_exit(); // i know i don't need it, but i'm paranoid > } Btw, you can use pointers with palletes, though I find that it usually isn't worth the trouble. Especially since the minimum block size in DJGPP is something like 4k (?) so you will be wasting memory when you malloc a chunk. Bbtw, it's "believe" :) -Mike