delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/25/11:10:47

From: Mark Phillips <umphill5 AT cs DOT umanitoba DOT ca>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Dynamically creating BITMAP arrays with C and Allegro.
Date: Fri, 25 Jun 1999 09:42:09 -0500
Organization: The University of Manitoba
Lines: 27
Message-ID: <Pine.SUN.3.96.990625093704.26249A-100000@silver.cs.umanitoba.ca>
References: <37737B76 DOT E907AD88 AT yahoo DOT com>
NNTP-Posting-Host: silver.cs.umanitoba.ca
Mime-Version: 1.0
X-Trace: canopus.cc.umanitoba.ca 930321734 16705 130.179.24.6 (25 Jun 1999 14:42:14 GMT)
X-Complaints-To: Postmaster AT cc DOT umanitoba DOT ca
NNTP-Posting-Date: 25 Jun 1999 14:42:14 GMT
In-Reply-To: <37737B76.E907AD88@yahoo.com>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> BITMAP *bitmapArray;
> bitmapArray=(BITMAP *) malloc(3*sizeof(BITMAP));
> 
> bitmapArray=load_bitmap("pe.bmp",*pal);
> 

to declare a regular bitmap you do this:

BITMAP* the_bitmap;
the_bitmap = load_bitmap("blah", pallete);

the_bitmap should already be a pointer to a bitmap (and if I remember
correctly, it's easier to not make the pallete a pointer to a pallete).

For an array of bitmaps try this:

BITMAP* the_bitmaps[NUM_BMPS];
the_bitmaps[0] = load_bitmap("blahblha",p);
the_bitmaps[1] = load_bitmap("blahblah2",p);
...

You never need to do any mallocing, load_bitmap does it for you.  Just
make sure to destroy_bitmap(the_bitmap[i]); for each bitmap that you
created before the program terminates.

Mark

- Raw text -


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