Getting FPS

coleislazy

  • *
  • Posts: 2607
Is there any way to get the current FPS? I'd like to be able to draw it on screen without having to open the console. I know the Profiler object knows the current FPS, among other things, but I can't figure out how to retrieve that information. Thanks!

AnachroNia

  • Posts: 72
Code: [Select]
var mtrTotal:org.flixel.FlxMonitor;
var loc:* = mtrTotal.average();
var fps:String = uint(1000/loc) + " fps";

coleislazy

  • *
  • Posts: 2607
Hmm... that is giving me an error #1009 when it tries to get mtrTotal.average();

Aber

  • Posts: 33
For testing, you can do control-shift-tilde(~) key for windows. Not sure this is what you want.

AnachroNia

  • Posts: 72
Code: [Select]
var mtrTotal:org.flixel.FlxMonitor;
mtrTotal = new org.flixel.FlxMonitor(8);
var loc:* = mtrTotal.average();
var fps:String = uint(1000/loc) + " fps";

v2 :)

coleislazy

  • *
  • Posts: 2607
Now it always produces 0.

Alexin

  • *
  • Posts: 3127
Script.getFPS

>_>

BTW, FlxMonitor works if you actually feed him some data. That's why it returns zero.

« Last Edit: August 25, 2011, 03:55:58 pm by Alexin »
"Find the fun"
alexin@stencyl.com

coleislazy

  • *
  • Posts: 2607
That was the first thing I tried. Unfortunately, it only returns the max desired framerate (which is always 60).

Okay, is it bad that I'm starting to end sentences with a semi-colon instead of a period? I think I've been working on this way too long.