Game Development Community

No FPS Debug

by Ian Riddell · in Torque 2D Beginner · 04/01/2014 (7:49 am) · 9 replies

I am unable to get the FPS to display on my scene.

I enabled a debugToggle on my keyboard. It works fine for AABB and collision shapes. I have confirmed that the FPS debug is enabled. But it is nowhere to be seen.

A previous post referenced the GUIProfile as a place to work on this. But the post lacked specifics.

Can anyone offer a starting place to look/test? My debug toggle function is pasted below. Thanks!

<begin code>
function debugToggle()
{
echo("call to debugToggle");
if ( $debugState == 1 ) myScene.setDebugOff("collision", "position", "aabb");
else myScene.setDebugOn("collision position aabb fps");
echo(myScene.getDebugOn());
$debugState = 1 - $debugState;
}
<end code>

here is the important part of the Console output.

<begin console output>
call to debugToggle
fps controllers aabb collision position
<end console output>

#1
04/01/2014 (8:25 am)
This is interesting - it should work. It works from the console in the default install.

ctrl-` to open the console, then type
SandboxScene.setDebugOn("collision position aabb fps")
and all functions as designed.

On another note, code blocks are marked up using MarkupLite (see the link right above the reply edit box) and so if you surround the word code with square brackets at the beginning of the code and /code with square brackets at the end it looks like my code block above.
#2
04/01/2014 (8:25 am)
<double post>
#3
04/01/2014 (8:34 am)
Thank you, I will try this tonight. I appreciate your help, Richard, I have read and benefited from a lot of your past posts.
#4
04/01/2014 (9:34 am)
A thing I noticed:
echo("call to debugToggle");
if ( $debugState == 1 ) myScene.setDebugOff("collision", "position", "aabb");
else myScene.setDebugOn("collision position aabb fps");
echo(myScene.getDebugOn());


//$debugState = 1 - $debugState; // should probably be:
$debugState = !$debugState; // this makes it true if it is false, or false if it is true
#5
04/01/2014 (8:55 pm)
Well typing ctrl-` has no effect in my game. Again, my toggle debug functions. I can switch it on and off with the keyboard stroke. I can see AABB and collision shapes when debug is enabled. I have verified that the FPS is seen as enabled. But no sign of FPS. Where is it supposed to display? What section of the screen? Perhaps it is "off screen" because I have altered the dimensions of the canvas.
#6
04/02/2014 (8:22 am)
Metrics (whether FPS or full) are rendered at the top of the screen. The rendering itself is part of the SceneWindow. The overlay pulls info on font type, font color, and background color from the GUI profile assigned to it. Make sure you have a well defined profile and are not doing something like displaying a white font on top of a white background. Have a look at the Sandbox SceneWindow profile for an example.
#7
04/02/2014 (10:16 am)
ctrl-` is the default keybind to bring up the console so I'm guessing you don't have the console in your project - too bad, it's handy. And you're right, of course; if the other features toggle then FPS should as well. I was shooting from the hip on that one....

Perhaps walking through it in the Sandbox will help you to see if you're missing something.
#8
04/02/2014 (10:54 am)
I think "well-defined GUI profile" might be the bulls-eye. My gui profile is just :
if(!isObject(GuiDefaultProfile)) new GuiControlProfile (GuiDefaultProfile)
{
Modal = true;
};
from the Getting Started Tutorial. I have been using a skeletal template that is the Getting Started tutorial with most of the guts scraped out.

@richard - thank you for your advice. Is there a good link to show me how to add the console functions to my bare-bones project?

@mike - Thank you for your advice as well. Is there a decent prototype for a "well-defined GUI profile" that I might copy/paste?
#9
04/02/2014 (11:57 am)
Adding a console to your project is covered in this tutorial - highly recommended:

github.com/GarageGames/Torque2D/wiki/Intro-to-the-GUI:-Part-1

The Sandbox has a gui profile example for the scene window, note that it inherits as well from the base default profile.

github.com/GarageGames/Torque2D/blob/master/modules/Sandbox/1/gui/guiProfiles.cs