BlitzCoder Essentials
•
Home Page
•
About BlitzCoder
•
Contributors
•
Terms of Use
•
Email Us
Main Areas
•
BlitzCoder Chat
•
Discussions
•
Articles/Tutorials
•
Code Database
•
Link Database
•
Showcase Area
•
Worklogs
•
Competitions
Special Areas
•
Undocumented
Other Blitz Sites
•
Blitz Basic Home
•
Blitz Showcase
•
BlitzPlay Library
Forum Login
Username:
Password:
•
Register Now!
BlitzCoder Code Archives Page
Main Codes Page
"Detecting Windows' framerate"
, by thechange
Measures the time it takes for a vertical blank using multiple readings. Useful for finding out if vertical sync is disabled.
Code
; In case you would require to know the exact time between each vertical blank for whichever reason, ; this is a pretty accurate program which you could use to find out if the person running this program ; has or has not disabled the vertical sync entirely. ; ; The only downside is that it takes a while (seconds) to get at least a somewhat accurate average. ; Naturally, the more time it takes to test -determined by the Cycles constant-, the more accurate the ; final average will be, as one reading is added per cycle. ; ; Another way is using an external DLL and communicating directly with Windows. Graphics 800,600 Print "Waiting..." Delay 1000 Print "Detecting..." Const Cycles = 100 For Count = 1 To Cycles VWait StartTime = MilliSecs () VWait StopTime = MilliSecs () Result# = Result + (StopTime - StartTime) + 0.1 Next Print "Result: " + (Result/Cycles) Print "Detected: " + (Int(1000/Float(Result/Cycles))) + "Hz" WaitKey End ;-->
Copyright(c) 2000-2004, BlitzCoder. All Rights Reserved.
Code software created by Krylar's Kreations