Mail Archives: djgpp/2000/06/26/18:05:33
On Mon, 26 Jun 2000 09:26:09 -0400, Radical NetSurfer
<radsmail AT juno DOT com> wrote:
>I finally decided to download a try out the new W.I.P....
>
>NOW:
> compiling my project in 3.1.2. --> 383,488 bytes
> 3.9.2. --> 610,816
> DIFFERENCE: 227,328
>
>WHY? is this? I have not had the time to read through
>all of the new 3.9.2. features and options.....
Allegro 3.9.x is designed for portability while retaining speed.
To shrink executables, strip and compress them with UPX.
http://upx.tsx.org/
>Problem 1:
>In 3.1.2: I wish to learn if and when a bitmap pointer has actually
>been assigned.....
>I have something like:
>BITMAP *a_bmp=NULL;
>
>a_bmp = create_bmp(z, q);
>
>NOW: what is the proper way to determine if 'a_bmp' is still
>un-assigned (NULL) or actually in use, SUCH THAT a
>proper call to 'destroy_bmp()' works....
>Apparently, calling destroy_bmp() crashes if the pointer is
>actually unassigned....
It crashes because the pointer points to garbage. Whenever you free
memory, it's safest to zero the pointer immediately afterwords..
BITMAP *foo;
foo = create_bitmap(w, h);
/* ... */
destroy_bitmap(foo);
foo = NULL;
free()-type functions typically do nothing if passed a null pointer.
I just read through .../allegro/src/graphics.c, and it works the same
way.
>Problem 2:
>
>In 3.1.2: I wish to be able to call a single function, which will
> either load in an image to a bitmap,
> or
> simply just create an empty bitmap,
> and return.....
>
> I want to call this function several times, and EACH time
>REPLACING the contents of the Bitmap, with the NEW
>image (raster)....
> Can someone PLEASE offer some suggestions how this
> might be accomplished?
Whenever you want to load in a new bitmap, simply call
destroy_bitmap(bmp) first.
--
Damian Yerrick
"I refuse to listen to those who refuse to listen to reason."
See the whole sig: http://www.rose-hulman.edu/~yerricde/sig.html
This is McAfee VirusScan. Add these two lines to your signature to
prevent the spread of signature viruses. http://www.mcafee.com/
- Raw text -