Mail Archives: djgpp/1999/05/02/16:31:54
From: | "Chuck U. Farley" <c128 AT bellsouth DOT net>
|
Newsgroups: | comp.os.msdos.djgpp
|
References: | <372ABD26 DOT 5E0A3FC5 AT hotmail DOT com> <7geuvu$6ks$1 AT newssrv DOT otenet DOT gr>
|
Subject: | Re: Bitmap Loading Problem
|
Lines: | 82
|
Organization: | SuperNova Software
|
X-Newsreader: | Microsoft Outlook Express 4.72.3110.5
|
X-MimeOLE: | Produced By Microsoft MimeOLE V4.72.3110.3
|
Message-ID: | <012X2.6422$4Z4.749@news1.atl>
|
Date: | Sun, 2 May 1999 15:52:55 -0400
|
NNTP-Posting-Host: | 209.214.40.230
|
X-Trace: | news1.atl 925674684 209.214.40.230 (Sun, 02 May 1999 15:51:24 EDT)
|
NNTP-Posting-Date: | Sun, 02 May 1999 15:51:24 EDT
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Pavlos is correct.
In your original code, you dont appear to be freeing the bitmap.
I bet you are running out of ram. Nice to know you can hold about 800
frames at once!
:)
-Chuck U. Farley
Pavlos wrote in message <7geuvu$6ks$1 AT newssrv DOT otenet DOT gr>...
>Well, first of all you shouldn't use create_bitmap()
>load_bitmap() allocates memory itself
>So, here's what you have to do for each .pcx
>
>'loop_start'
>
>buffer=load_bitmap(.....)
>blit(...)
>free(buffer);
>
>'loop_end'
>
>
>
>Denis Lamarche wrote in message <372ABD26 DOT 5E0A3FC5 AT hotmail DOT com>...
>>Ok...I've a big problem (but aren't they all). I mage a myst type game
>>that just loads pcx
>>files from my hard drive to simulate motion. Works fine, but if I load
>>a pcx into the same
>>buffer(BITMAP *buffer) then it stops loading the pcx. The code below
>>should explain it all.
>>when the for loop gets to 800(or so) it doesnt load the pcx any more.
>>What am I doing wrong?
>>Do I have to close the pcx file or something?
>>
>>
>>Denis Lamarche
>>
>>
>>
>>#include <stdio.h>
>>#include <allegro.h>
>>
>>BITMAP *buffer;
>>PALETTE pal;
>>
>>int main()
>>{
>>allegro_init();
>>set_gfx_mode(GFX_VGA, 320, 200, 0, 0);
>>buffer=create_bitmap(320,200);
>>
>>for (int i=0;i<10000;i++)
>> {
>> buffer=load_bitmap("c:\\flc\\rm1t10.pcx", pal); //Or any 320x200x256
>>pcx file
>> if (buffer==NULL)
>> {
>> textprintf(screen, font, 10, 40, 20, "cannot load pcx at %d
>>",i);
>> }
>> else
>> {
>> set_palette(pal);
>> textprintf(buffer, font, 10, 10, 20, "%d ", i);
>> blit(buffer, screen, 0, 0, 0, 0, 320, 200);
>> }
>> }
>>
>>
>>getchar();
>>destroy_bitmap(buffer);
>>allegro_exit();
>>return 69;
>>}
>
>
- Raw text -