delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/05/21:42:39

Message-ID: <336D41CD.4DE1@total.net>
Date: Sun, 04 May 1997 19:11:25 -0700
From: Leslie E Murphy <lemurphy AT total DOT net>
Reply-To: lemurphy AT total DOT net
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: more with Sprites in Allegro
References: <336cda63 DOT 5017831 AT news DOT primenet DOT com>
NNTP-Posting-Host: 205.236.84.46
Organization: TotalNet Inc.
Lines: 37
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019