Mail Archives: djgpp/1997/05/05/21:42:39
Mike McLean wrote:
>
> 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 <allegro.h>
> 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);
blit(spr, screen, source_x, source_y, dest_x, dest_y, width, height);
> delay(2000);
> set_gfx_mode(GFX_TEXT,80,25,0,0);
> }
You _really_ should have a look at the demo files included with Allegro;
they do the things written about in the doc.
Good luck,
Les
--
Leslie E Murphy
lemurphy AT total DOT net
- Raw text -