[futurebasic] Re: Detecting the VBLINT on Mac monitors

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : April 1998 : Group Archive : Group : All Groups

From: Charlie Dickman <charlied@...>
Date: Wed, 1 Apr 1998 19:30:36 -0500
I don't know whether this is what you're asking for or not but it does work
and you might be able to use it.

'
' fbII VBL task example
' by l. frank turovich
' copyright ©1996 sentient fruit
' all rights reserved worldwide
'
' Email: turovich@...
' Web:   http://home.earthlink.net/~turovich/
'
' demonstrates how to implement a VBL task in FBII
'
' ----------------------------------------------

' assign an interval for VBL task
_kInterval = 6

' setup VBL record to use for task
DIM gVblPtr&, gVblRecord.16
DIM gCount%
END GLOBALS

' make sure to jump over procs
GOTO "End of Procs"
' this simple VBL task simply increments a variable
' and prints it to the window, note that we reset the
' vblCount% each time we exit the task in order for it
' to be called again
"VBLTask"
ENTERPROC
  INC( gCount% )
  PRINT gCount%
  gVblRecord.vblCount% = _kInterval
EXITPROC
"End of Procs"


LOCAL FN SetupVBL
  ' get pointer to VBL record
  gVblPtr& = @gVblRecord
  ' setup record for VBL task
  gVblRecord.vblType%     = 1
  gVblRecord.vblAddr&     = LINE "VBLTask"
  gVblRecord.vblCount%    = _kInterval
  gVblRecord.vblPhase%    = 0
  ' install VBL task
  err% = FN VINSTALL( gVblPtr& )
END FN = err%


LOCAL FN RemoveVBL
  ' make sure VBL task got installed, then remove
  LONG IF gVblPtr& <> _nil
    err% = FN VREMOVE( gVblPtr& )
    gVblPtr& = _nil
  END IF
END FN


WINDOW #1
TEXT _applFont, 10
' setup our VBL task
err% = FN SetupVBL
LONG IF err% = 0
  DO
  UNTIL gCount% = 25
  ' make sure to remove VBL task when finished
  FN RemoveVBL
XELSE
  BEEP
END IF

STOP


Charlie Dickman
charlied@...