TGB - Dertmining Framerate/FPS?
by Brian Wilson · in Torque Game Builder · 05/10/2008 (4:01 am) · 2 replies
Is there a way to access the vars direction in setDebugOn(0) to capure the current framerate? Or is there another method of getting the current framerate in TGB (1.7.2)?
#2
05/13/2008 (1:52 pm)
"echo($fps::real)" gives you the current fps anytime. Just like old tribes 2 scripting :o
Torque Owner Brian Wilson
There is a generic function that pops up stats in a small text gui called metrics(%expr). The code is in ~/common/gameScripts/metrics.cs
function metrics(%expr) { switch$(%expr) { case "audio": %cb = "audioMetricsCallback()"; case "debug": %cb = "debugMetricsCallback()"; case "fps": %cb = "fpsMetricsCallback()"; case "time": %cb = "timeMetricsCallback()"; case "texture": GLEnableMetrics(true); %cb = "textureMetricsCallback()"; case "video": %cb = "videoMetricsCallback()"; }Which leads to fpsMetricsCallback() in the same file:
function fpsMetricsCallback() { return " FPS: " @ $fps::real @ " mspf: " @ 1000 / $fps::real; }So: