cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/11/05:26:16

From: DavMac AT iname DOT com (Davin McCall)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: c,allegro,coolness....
Date: Sat, 11 Sep 1999 09:08:22 GMT
Organization: Monash Uni
Lines: 58
Distribution: world
Message-ID: <37da1aa0.17215385@newsserver.cc.monash.edu.au>
References: <37D9D699 DOT 8BFA4EF6 AT gtcom DOT net> <37DA07F7 DOT 182B297C AT hmc DOT edu> <37DA1143 DOT C8E47EFF AT gtcom DOT net>
NNTP-Posting-Host: damcc5.halls.monash.edu.au
X-Trace: towncrier.cc.monash.edu.au 937040836 14843 130.194.198.138 (11 Sep 1999 09:07:16 GMT)
X-Complaints-To: abuse AT monash DOT edu DOT au
NNTP-Posting-Date: 11 Sep 1999 09:07:16 GMT
X-Newsreader: Forte Free Agent 1.1/32.230
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


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