Mail Archives: djgpp/1998/01/29/16:23:27
In article <19980129094901 DOT EAA26113 AT ladder02 DOT news DOT aol DOT com>,
fist1000 AT aol DOT com says:
> > draw_sprite(screen,datafile[spritename].dat,16,16);
> >
> >spritename is a char with a 20 character array, containing "BLANK".
>
> First of all, you can't index an array with a string. :) When you save your
Woops, I said that wrong. Here is my variable declaration:
char spritename[20] = "BLANK";
That's valid, right?
> datafile in Allegro's grabber, you need to make sure you specify a header file
> in the "Header:" text box. When you save your datafile, the grabber will write
> a header file to disk containing some #defines which you can use for
> subscripting your datafile array.
The header and stuff's all taken care of with Grabber, and I've checked
just to verify. BLANK is declared in my datafile, as a BMP.
> So, for example, if BLANK were one of the defines in your header file, you
> would code thusly:
>
> draw_sprite(screen, datafile[BLANK].dat,16,16);
Except that I don't want the function to always draw BLANK to the
screen. I want to use my variable, spritename, because the sprite I
want drawn is depending on which sprite the user chooses in my program.
And I'm coding under C, not C++ (just so you know all the other C++
doesn't apply :)
Thanks!
____________________________
Matt Riker
SPAMGUARDriker AT pipcom DOT com
*** Remove SPAMGUARD ***
*** when replying! ***
- Raw text -