www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/28/18:23:53

Date: Wed, 28 Jan 1998 15:23:08 -0800 (PST)
Message-Id: <199801282323.PAA15339@adit.ap.net>
Mime-Version: 1.0
To: riker AT pipcom DOT com, djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: Allegro Datafiles

At 11:22  1/28/1998 -0500, Matt Riker wrote:
>I'm writing a program that uses Allegro datafiles, reading sprite files 
>from them more specifically.  My problem is, the sprite that I want to 
>read from the datafile constantly changes.  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.  I've kind of done a poor job of explaining this, but 
>if anyone has the vaguest idea of what I'm talking about, your help 
>would be appreciated :)  Thanks!
Why not just do something like:

int piece_of_data; /* I think `int' is correct, or at least should work */

/* ... */

piece_of_data = SPRITENAME; /* change for the appropriate sprite */
draw_sprite(doublebuffer, datafile[piece_of_data].dat, 16, 16);

Hope this is something similar to what you want.

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


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