Mail Archives: djgpp/1999/09/11/05:26:16
Again: It's bad practice, you shouldn't do it. You may be able to save
100 screen captures this way on your machine (with 32MB RAM), but then
try to take it to a machine with 2MB RAM and no virtual memory, and
see what happens...
Or, what if you later use the same code for another purpose,
forgetting that it causes a memory leak, which saves the screen many
thousands of times?
If you really want to save on typing, why not just write a fucntion,
something like this:
--- begin ---
void SaveScreen(char *fname)
{
BITMAP *bmp;
PALETTE pal;
get_palette(pal);
bmp = create_sub_bitmap(screen, 0, 0, SCREEN_W, SCREEN_H);
save_bitmap("dump.pcx", bmp, pal);
destroy_bitmap(bmp);
}
--- end ---
Save it in a file, put it in a library, write a header, and voila...
Davin.
On Sat, 11 Sep 1999 04:22:27 -0400, Krogg <krogg DOT no DOT to DOT spam AT gtcom DOT net>
wrote:
>Hmmm,I was wondering about that.It is only used once and
>then the program exits so it wont be a problem for this
>particular program.
>
>let me try something......Ok done....
>
>I just added a for loop to call:
>
>save_pcx("ifs.pcx",create_sub_bitmap(screen, 0, 0, SCREEN_W,SCREEN_H),pallete);
>
>100 times in a row to test this out.It didnt crash..I got
>32 megs ram.I aint sure if this is cause win95 is providing
>plenty of virtual memory or what....
>
>You probly know more that i do about it,but i am still
>clinging on to the idea that it works really good.
>
>Was 100 times not enough for a good test?
>
>Be Cool,
> Krogg.
__________________________________________________________
*** davmac - sharkin'!! davmac AT iname DOT com ***
my programming page: http://yoyo.cc.monash.edu.au/~davmac/
- Raw text -