From 853bca2fe49aeeccc59687f733e7b9a3e0d8e416 Mon Sep 17 00:00:00 2001 From: dexy Date: Thu, 30 Dec 2021 20:38:24 +1100 Subject: [PATCH] Reduce FPS when CW is not in the foreground --- CodeWalker/Rendering/DirectX/DXManager.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CodeWalker/Rendering/DirectX/DXManager.cs b/CodeWalker/Rendering/DirectX/DXManager.cs index d9feffb..534083f 100644 --- a/CodeWalker/Rendering/DirectX/DXManager.cs +++ b/CodeWalker/Rendering/DirectX/DXManager.cs @@ -281,6 +281,10 @@ namespace CodeWalker.Rendering Thread.Sleep(10); //don't hog CPU when 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; if(!Monitor.TryEnter(syncroot, 50))