mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
Merge pull request #1076 from Areloch/NilsUI_Updates_ConsoleTimeTweaks
Tweaks some of the handling for timestamp stuff
This commit is contained in:
commit
1f9cc0d5ef
1 changed files with 23 additions and 5 deletions
|
|
@ -307,6 +307,9 @@ bool alwaysUseDebugOutput = true;
|
||||||
bool useTimestamp = false;
|
bool useTimestamp = false;
|
||||||
bool useRealTimestamp = false;
|
bool useRealTimestamp = false;
|
||||||
|
|
||||||
|
static U32 initTime = Platform::getRealMilliseconds();
|
||||||
|
U32 startTime = initTime;
|
||||||
|
|
||||||
ConsoleFunctionGroupBegin( Clipboard, "Miscellaneous functions to control the clipboard and clear the console.");
|
ConsoleFunctionGroupBegin( Clipboard, "Miscellaneous functions to control the clipboard and clear the console.");
|
||||||
|
|
||||||
DefineEngineFunction( cls, void, (), , "()"
|
DefineEngineFunction( cls, void, (), , "()"
|
||||||
|
|
@ -327,7 +330,7 @@ DefineEngineFunction( getClipboard, const char*, (), , "()"
|
||||||
};
|
};
|
||||||
|
|
||||||
DefineEngineFunction( setClipboard, bool, (const char* text), , "(string text)"
|
DefineEngineFunction( setClipboard, bool, (const char* text), , "(string text)"
|
||||||
"@brief Set the system clipboard.\n\n"
|
"@brief Set the system clipboard.\n\n"
|
||||||
"@internal")
|
"@internal")
|
||||||
{
|
{
|
||||||
return Platform::setClipboard(text);
|
return Platform::setClipboard(text);
|
||||||
|
|
@ -335,6 +338,20 @@ DefineEngineFunction( setClipboard, bool, (const char* text), , "(string text)"
|
||||||
|
|
||||||
ConsoleFunctionGroupEnd( Clipboard );
|
ConsoleFunctionGroupEnd( Clipboard );
|
||||||
|
|
||||||
|
DefineEngineFunction( resetTimeStamp, void, (), , "()"
|
||||||
|
"@brief Reset the timestamp to 0 ms.\n\n"
|
||||||
|
"@ingroup Console")
|
||||||
|
{
|
||||||
|
startTime = Platform::getRealMilliseconds();
|
||||||
|
};
|
||||||
|
|
||||||
|
DefineEngineFunction( getInitTime, int, (), , "()"
|
||||||
|
"@brief Get the initialization time in miliseconds.\n\n"
|
||||||
|
"@internal")
|
||||||
|
{
|
||||||
|
return initTime;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
void postConsoleInput( RawData data );
|
void postConsoleInput( RawData data );
|
||||||
|
|
||||||
|
|
@ -644,7 +661,7 @@ static void _printf(ConsoleLogEntry::Level level, ConsoleLogEntry::Type type, co
|
||||||
{
|
{
|
||||||
if (!active)
|
if (!active)
|
||||||
return;
|
return;
|
||||||
Con::active = false;
|
Con::active = false;
|
||||||
|
|
||||||
char buffer[8192] = {};
|
char buffer[8192] = {};
|
||||||
U32 offset = 0;
|
U32 offset = 0;
|
||||||
|
|
@ -664,16 +681,15 @@ static void _printf(ConsoleLogEntry::Level level, ConsoleLogEntry::Type type, co
|
||||||
|
|
||||||
if (useTimestamp)
|
if (useTimestamp)
|
||||||
{
|
{
|
||||||
static U32 startTime = Platform::getRealMilliseconds();
|
|
||||||
U32 curTime = Platform::getRealMilliseconds() - startTime;
|
U32 curTime = Platform::getRealMilliseconds() - startTime;
|
||||||
offset += dSprintf(buffer + offset, sizeof(buffer) - offset, "[+%4d.%03d]", U32(curTime * 0.001), curTime % 1000);
|
offset += dSprintf(buffer + offset, sizeof(buffer) - offset, "[+%4d.%03d]", U32(curTime * 0.001), curTime % 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useTimestamp || useRealTimestamp) {
|
if (useTimestamp || useRealTimestamp)
|
||||||
|
{
|
||||||
offset += dSprintf(buffer + offset, sizeof(buffer) - offset, " ");
|
offset += dSprintf(buffer + offset, sizeof(buffer) - offset, " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
dVsprintf(buffer + offset, sizeof(buffer) - offset, fmt, argptr);
|
dVsprintf(buffer + offset, sizeof(buffer) - offset, fmt, argptr);
|
||||||
|
|
||||||
for(S32 i = 0; i < gConsumers.size(); i++)
|
for(S32 i = 0; i < gConsumers.size(); i++)
|
||||||
|
|
@ -2652,3 +2668,5 @@ void ConsoleStackFrameSaver::restore()
|
||||||
gCallStack.popFrame();
|
gCallStack.popFrame();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue