Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

Keep the game running when the window is behind another one

yhh9613da447f71
diff --git a/desktop/electron/main.ts b/desktop/electron/main.ts
index 5368bb665..c1ad226fb 100644
--- a/desktop/electron/main.ts
+++ b/desktop/electron/main.ts
@@ -84,6 +84,11 @@ app.commandLine.appendSwitch('enable-unsafe-webgpu');
app.commandLine.appendSwitch('disable-background-timer-throttling');
app.commandLine.appendSwitch('disable-renderer-backgrounding');
app.commandLine.appendSwitch('disable-backgrounding-occluded-windows');
+// And the one that actually does it on Windows: Chromium asks the OS whether the window
+// is covered, and a window merely BEHIND another counts — so the moment you click on
+// anything else the game drops to about one frame a second. The switches above do not
+// turn that calculation off; this does.
+app.commandLine.appendSwitch('disable-features', 'CalculateNativeWinOcclusion');
// Two privileged custom schemes (must be declared before app ready):
// • estella:// serves files from the open project root (sandboxed) — lets the