delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/29/16:23:27

From: SPAMGUARDriker AT pipcom DOT com (Matt Riker)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Allegro Datafiles - More Problems
Date: Thu, 29 Jan 1998 13:12:30 -0500
Organization: Riker Software
Lines: 40
Message-ID: <MPG.f3a9094a793600b9896bf@news>
References: <MPG DOT f39e7cbc8b4c11d9896bd AT news> <19980129094901 DOT EAA26113 AT ladder02 DOT news DOT aol DOT com>
Reply-To: SPAMGUARDriker AT pipcom DOT com
NNTP-Posting-Host: 207.61.241.233
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


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