WorldEditor FPS hud
by Justin Knight · 04/24/2012 (7:45 am) · 4 comments
In tools/worldEditor/gui/EditorGui.ed.gui line 312, add:
At the top of tools/worldEditor/gui/EditorGui.ed.gui add:
In the same file in function toggleEditor, at line 169 add the commented line
new GuiContainer(statsBar) {
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "200 690";
extent = "398 29";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMenuBarProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
new GuiTextCtrl(editorPolyLabel) {
text = "Poly:69086";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "20 0";
extent = "130 28";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMediumTextProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiTextCtrl(editorFPSLabel) {
text = "FPS:90.1";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "160 0";
extent = "110 28";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMediumTextProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiTextCtrl(editorDrawLabel) {
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "275 0";
extent = "120 28";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiMediumTextProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
};This adds the HUD to the WorldEditor interfaceAt the top of tools/worldEditor/gui/EditorGui.ed.gui add:
function Editor::updateCounters()
{
editorFPSLabel.setValue( "FPS:" @ $fps::real);
editorPolyLabel.setValue( "Poly:" @ $GFXDeviceStatistics::polyCount);
editorDrawLabel.setValue( "Draw:" @ $GFXDeviceStatistics::drawCalls);
}
function updateCounters() {
Editor::updateCounters();
if( EditorIsActive())
schedule( 1000, 0, updateCounters);
}This adds the function to update the HUDIn the same file in function toggleEditor, at line 169 add the commented line
popInstantGroup();
}
updateCounters(); // Add this line
%elapsed = stopPrecisionTimer( %timerId );
#2
04/24/2012 (11:35 am)
Nice - I hadn't come across that metrics script before, lots of useful stuff in there.
#3
04/24/2012 (4:00 pm)
I also had a long time to look in that metrics.cs. But if i did that, i was happy to know how easy it is to see the fps and other things. This metrics should be standard on a hotkey.
#4
04/24/2012 (5:09 pm)
Awesome idea! 
Torque Owner D Fasel
Game 3D
and just make a hotkey to call it.
EDIT:
I made it that way: (put the following script in scripts>cliend>defaultbind.cs to the end of file)
//Metrics
function toggleMetrics( %val )
{
if ( %val )
{
if ( $toggleM == false)
{
$toggleM = true;
metrics( "fps gfx" );
}
else
{
$toggleM = false;
metrics( "" );
}
}
}
GlobalActionMap.bind(keyboard, "ctrl F10", toggleMetrics);
and now, you can just use control and F10 to toggle the metrics gui. see also game>core>scripts>client>metrics.cs for more info about this.