Mail Archives: djgpp/1998/01/28/18:23:53
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 -