Mail Archives: djgpp/2000/06/26/19:30:35
On Mon, 26 Jun 2000 18:58:36 GMT, Damian Yerrick
<Bullcr_pd_yerrick AT hotmail DOT comRemoveBullcr_p> wrote:
>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....
>> compiling my project in 3.1.2. --> 383,488 bytes
>> 3.9.2. --> 610,816
>> DIFFERENCE: 227,328
>>
>>WHY? is this?
>
>Allegro 3.9.x is designed for portability while retaining speed.
>To shrink executables, strip and compress them with UPX.
> http://upx.tsx.org/
I'll look into this....thanks.
>>Problem 1:
>>In 3.1.2:
>>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.
YES! I know about this; but it got totally passed me!
I've had this problem in C++ before; and I'm compiling as 'C' now so I
wasn't thinking...
>>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.
YES! I did manage to get this part working as well!
after the above problem was solved, other things fell into place.
Again, thanks for you help. It really gave me inspiration to not give
up... :-)
http://members.tripod.com/~RadSurfer/
- Raw text -