Blitz3D+ Command Reference

ScanLine ( )

Parameters

None.

Description

Returns the scan line the monitor is currently drawing - always 0 on the modern runtime.

In the CRT era this reported which horizontal line of the display was being refreshed at that instant, and clever code raced the beam to update the screen without tearing. Modern displays are composited by Windows and no beam position is exposed, so this command always returns 0 and exists only so classic code still runs.

For smooth, tear-free updates just use Flip with its default vwait - it syncs to the display refresh for you.

See also: Flip, VWait.

Example

; ScanLine Example
; ----------------

Graphics 640,480,0,2
SetBuffer BackBuffer()

While Not KeyDown(1)

    Cls

    ; ScanLine reports the raster line the display is currently refreshing
    sl=ScanLine()

    ; Draw a marker at that height (when it falls inside the window)
    Color 0,255,0
    If sl>=0 And sl<480 Then Line 0,sl,639,sl

    Color 255,255,255
    Text 0,0,"Esc: exit"
    Text 0,20,"ScanLine() = "+sl+" (sampled once per frame)"

    Flip

Wend

End

Index