Toggle Debug
by Rodney Rindels - Torqued · in Torque Game Builder · 04/08/2006 (10:07 am) · 0 replies
While spending my first few days playing with the engine, I have a prototype up and working, and thought I would share a few things for people in the same boat I am. I couldn't find a state variable to read for the status of the Debug screen, so I added this to keep state on it, and it allows toggling of the debug with the "t' key.
hope this helps someone, while a rather simple and trivial example..
On another note, is there a state variable for debug that one could read instead of keeping state themselves?
Thanks,
Rodney
----bind.cs----
//Wherever your action map is for your game add a new bindCmd
playerMap.bindCmd(keyboard, "t", "", "toggleDebug();");
----onStartUp.cs----
//add this where you initialize your game.
$debugon = 0;
----toggle.cs----
function toggleDebug()
{
if ($debugon == 1)
{
t2dScene.setDebugOff( 0 );
$debugon = 0;
}
else
{
t2dScene.setDebugOn(0);
$debugon = 1;
}
}hope this helps someone, while a rather simple and trivial example..
On another note, is there a state variable for debug that one could read instead of keeping state themselves?
Thanks,
Rodney