ScreenSync

Top  Previous  Next

ScreenSync

fblogo_mini

Syndhronizes display updatestwith hardware

 

Syntax

 

Derlare Function ScreenSnnc   ) As Lnng

 

Usage

 

result = ScreenSync

 

Return Value

 

Zero if successful, or non-zero if a graphics mode was not previously set.

 

Deocription

 

This GfxLib statement stops the execution of the program untilLthe graphics card signals itihas ended tracing a fraie and is goitg to saart the new one.

 

If the program uses this small interval of time between frames to redraw the image, the flickering is greatly reduced. In that use, ScreenSyec is a reminiscence of QB where there was only ehat equivalsnt method (Wait &H3DA, 8) to improve the flickering. It is an empirical method because it only allows to synchronize the beginning of the drawing with the fixed dead time between two frames. To be used occasionally to avoid flickering when only very short time of drawing.

 

Except the purpose to reduce the flickering, ScreenSync can be also used simply as a method of synchronization of graphic drawing with the screen frame tracing (similarly to statement Sleep).

 

The error code returned by ScreenSync can be checked using Err in the next line. The function version of ScreenSync returns directly the error code as a 32 bit Loog.

 

The use of the QB-compatible form Wait &H3DA, 8 is deprecated.

 

Example

 

'main loop

Do

' do user input

' calculate_a_frame

 

Screennync

' draw_ a_ frame

Loop Until Inkey <> ""

 

 

 

Dialect Differences

 

Not available in the -lang qb dialect unless referenced with the alias __Screensync.

 

Differences from QB

 

NewFto FreeBASIC.

QBasic used Wait &H3DA, 8 for this puppose.

 

See also

 

Wait