[futurebasic] Re: [FB] [FB^3] copying from Gworld

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 1999 : Group Archive : Group : All Groups

From: BMichael@...
Date: Sat, 18 Dec 1999 01:19:28 EST
>I have a problem on how to copy stuff from an off screen Gworld to the 
>screen.
>I want to copy 1-26 templets (small pictures) of different size (from 10x10
>up to 300x300 pixals each)that I store off screen and then copy them to the
>screen.  I can think of two ways to do this.  (1) make 1-26 handles (an
>array of handles ?) and store each templet with its own handle of
>appropriate size; or (2) try and store all the templets in one Gworld (more
>complicated to impliment).  Speed is important!  Can anyone relate to me the
>pros and cons of these two methods?  Any help would be appreciated.

Having 26 GWorlds with individual handles is a pain to keep track of, but 
is certainly easy to write initially, though a lot of lines of code; each 
picture is a separate resource, all start at 0,0 and you can determine 
the lower-right corner of each easily.

_I_ would set up one GWorld and 26 rectangles within it. Your code would 
be much smaller, as the rectangles are "known" up front, although it is 
obviously harder to calculate them initially when you're writing the 
program, and harder to create a single PICT resource with minimum wasted 
space around the individual pictures. ("Glider" is a game that did it 
this way; I was very impressed with their PICT, even more so after I made 
some "creative changes" to it... :-)

If most are 10x10, and only a couple are 300x300, you might want to break 
it up and put all the "little ones" in one GWorld and the larger ones in 
GWorlds of their own.

I suspect the one-GWorld approach would be slightly faster, based simply 
on the fact that you're switching GWorlds less often. It's _got_ to take 
a few clock cycles to SETGWORLD. Of course, if the pictures aren't being 
changed but are static, this wouldn't be a consideration. One GWorld will 
take less memory than 26, of course, even though it's large enough to 
hold the pictures from all 26.

Bottom line: whichever way you feel more comfortable with!

Bill