[futurebasic] Re: [FB] Offscreen globaltolocal etc. driving me crazy

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

From: CaverDave@...
Date: Fri, 3 Sep 1999 19:32:05 EDT
   I wasn't following this line of discussion, but perhaps I can help...

>I'm doing it purely for speed.  My window takes a long time to refresh itself
>the regular way.  Although I'm not writing a graphical game per se, I think
>games programmers do a lot of refreshing in this manner.  The frustrating 
part
>is the only thing that's not working is the coordinates.

   Here is how I determine the drawing coordinants before drawing directly to 
on-screen windows...  Is that your problem?

'  First I find the window coordinants on the screen
DIM  PT as POINT
PT.h%=0
PT.v%=0
CALL LOCALTOGLOBAL(PT)
'  The I put the values into Global Vars (only test once per frame)
gWINDH%=PT.h%
gWINDV%=PT.v%

'  Then far away in the drawing part of the program
'  I'm finding the Source and Destination Pixmap addresses
DESTPIXMAP&=FN GETGWORLDPIXMAP(DESTPORT&)
SRCPIXMAP&=FN GETGWORLDPIXMAP(SRCPORT&)
LOCKED% = FN LOCKPIXELS(DESTPIXMAP&)
LOCKED2% = FN LOCKPIXELS(SRCPIXMAP&)
SRCBASE& = FN GETPIXBASEADDR(SRCPIXMAP&)
SRCROW& = {[SRCPIXMAP&] + _pmRowBytes}
SRCROW& = SRCROW& AND 8191
DESBASE& = FN GETPIXBASEADDR(DESTPIXMAP&)
DESROW& = {[DESTPIXMAP&] + _pmRowBytes}
DESROW& = DESROW& AND 8191
'  Now I'm testing too see if the Destination Port is my visible Game Window
'  If so, adjust the destination address for the window coordinants
LONG IF SRCPORT&=gWINDPORT&
SRCSTART&=SRCBASE&+(THERECT.top%*SRCROW&)+THERECT.left%
LONG IF DESTPORT&=gWINDPORT&'Drawing To Window?
'  Offset Graphics Target by Window Coords...
DESSTART&=DESBASE&+((THERECT.top%+gWINDV%)*DESROW&)+THERECT.left%+gWINDH%
XELSE
DESSTART&=DESBASE&+(THERECT.top%*DESROW&)+THERECT.left%
END IF

   Maybe this isn't what you are trying to solve, but I'm sure it will be 
useful to somebody!

David Herron
CaverDave@...