Scanline + make life a little easier for yourself!

BlitzPlus Forums/BlitzPlus Programming/Scanline + make life a little easier for yourself!

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Scanline() returns the integer index of the scanline that is currently being redrawn on your screen. (A scanline is the horizontal row of pixels from the left to the right of your monitor, and are usually numbered from top to bottom of your screen, from 0 to your resolution height.)

Try this simple little program to see a demo. It reports your approximate vertical resolution and your approximate refresh rate.

sc_low = ScanLine()
sc_high = sc_low
Repeat
	s% = ScanLine()
	If s < sc_low Then sc_low = s
	If s > sc_high Then sc_high = s
	If s = sc_high Then 
		Print (1000.0 / Float (MilliSecs() - oldtime)) + " Hz (" + sc_low + "," + sc_high + ")"
		oldtime% = MilliSecs()
	EndIf
Forever