[hint / solution] low framerate when window has not the focus
by Thomas Bang · in Torque Game Engine · 07/28/2010 (8:39 am) · 1 replies
To avoid that, go to winWindow.cc line 958.
In Platform::process() you will find this piece of code:
Comment out this code or simple comment out this single line
Recompile the engine. After that, you will not have any drop down of the framerate even when your window has not the focus.
In Platform::process() you will find this piece of code:
HWND window = GetForegroundWindow();
if (window && window != winState.appWindow && gWindowCreated)
{
// check to see if we are in the foreground or not
// if not Sleep for a bit or until a Win32 message/input is recieved
DWORD foregroundProcessId;
GetWindowThreadProcessId(window, &foregroundProcessId);
if (foregroundProcessId != winState.processId)
MsgWaitForMultipleObjects(0, NULL, false, getBackgroundSleepTime(), QS_ALLINPUT);
}
// if there's no window, we sleep 1, otherwise we sleep 0
else if(!Game->isJournalReading() && gWindowCreated )
Sleep( 1 ); // give others some process time if necessary...Comment out this code or simple comment out this single line
MsgWaitForMultipleObjects(0, NULL, false, getBackgroundSleepTime(), QS_ALLINPUT);
Recompile the engine. After that, you will not have any drop down of the framerate even when your window has not the focus.
Torque Owner Wes Macdonald