delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/28/18:00:31

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Allegro Datafiles
Date: Wed, 28 Jan 1998 19:13:47 +0000
Organization: None
Distribution: world
Message-ID: <ed0UjOArN4z0EwTG@talula.demon.co.uk>
References: <MPG DOT f39253f2baddac19896b9 AT news>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 22
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Matt Riker writes:
>The normal format for drawing a sprite from the datafile is this:
>
>draw_sprite(doublebuffer, datafile[SPRITENAME].dat, 16, 16);
>
>But because SPRITENAME is constantly changing, I need to put in a 
>variable instead.

So, put it in a variable! There is no problem with that. The object ID
is just an integer value that is being used to index into the datafile
array, so it can come from wherever you like. Your SPRITENAME symbol is
#defined to a particular value in the header file that the grabber
produces, but it is a normal numeric constant: there is nothing magical
about it.

See the ex21.c program for an example of how to compute the object ID
for an animating sprite.


--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
"Pigs use it for a tambourine" - Frank Zappa

- Raw text -


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