Newsgroups: comp.os.msdos.djgpp From: tob AT world DOT std DOT com Subject: Re: more with Sprites in Allegro Message-ID: Sender: tob AT world DOT std DOT com (Tom Breton) Reply-To: tob AT world DOT std DOT com Organization: BREnterprises References: <336cda63 DOT 5017831 AT news DOT primenet DOT com> Date: Tue, 6 May 1997 03:38:51 GMT Lines: 50 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk libolt AT primenet DOT com (Mike McLean) writes: > Thanks for those who responded to my earlier question. Now I've got > the sprite into an allegro data file. The only problem is I can't > figure out how to display it. here is the code i am using > > > #include > void main(int argc, char *argv[]) > { > char datafile_name[80]; > int frame; > BITMAP *spr; > DATAFILE *data; > strcpy(datafile_name, argv[0]); > strcpy(get_filename(datafile_name), "cool.dat"); > set_gfx_mode(GFX_AUTODETECT,640,480,0,0); > data = load_datafile (datafile_name); > set_pallete(data[1].dat); > draw_sprite (spr, data[frame].dat,0,0); Crashes with SIGSEGV, I guess? You're writing the data to an uninitialized pointer which, even if initialized, would not be the screen. I didn't look to see if there were any other problems. Try instead draw_sprite (screen, (BITMAP *)data[frame].dat,0,0); Better, read the docs and try the demos. They all work (for me, anyways), and they do most of the "tricky" stuff. Compile them. Fool around with them. See why they do what they do. Tom -- See my Married... With Children index page, http://world.std.com/~tob/mwc.htm Fox can be reached at: Fox Network Primetime Fox Broadcasting P.O. Box 900 Beverly Hills, CA 90213 phone: (310) 369-1000 email: askfox AT foxinc DOT com To beg WB or UPN to pick MWC up, visit: http://www.primenet.com/~rnovello/bq0.htm The e-mail for Warner Bros Television is wbnetwork AT aol DOT com