Reduce FPS when CW is not in the foreground

This commit is contained in:
dexy 2021-12-30 20:38:24 +11:00
parent ab0bf465dc
commit 853bca2fe4

View File

@ -281,6 +281,10 @@ namespace CodeWalker.Rendering
Thread.Sleep(10); //don't hog CPU when minimised Thread.Sleep(10); //don't hog CPU when minimised
if (dxform.Form.IsDisposed) return; //if closed while minimised if (dxform.Form.IsDisposed) return; //if closed while minimised
} }
if (Form.ActiveForm == null)
{
Thread.Sleep(100); //reduce the FPS when the app isn't active (maybe this should be configurable?)
}
Rendering = true; Rendering = true;
if(!Monitor.TryEnter(syncroot, 50)) if(!Monitor.TryEnter(syncroot, 50))