From bd94adc9ecddca4374dff350cfcc0ca1d9614b3a Mon Sep 17 00:00:00 2001 From: epicmeme546 <178368684+epicmeme546@users.noreply.github.com> Date: Thu, 12 Nov 2026 07:09:55 -0500 Subject: [PATCH] Stop the launcher's animations while another window is in front, so a launcher left open behind the game no longer draws every 15 ms. With Hide Launcher While Playing off, the launcher stayed in its normal state behind the game and kept stepping its animations: about 0.6 of a CPU core went to a window nobody saw, beside the game's render thread. The animations now also stand still while the window is not in front, the same check the gamepad polling uses. Co-Authored-By: Claude Opus 5.5 --- docs/launcher.md | 3 ++- launcher/ui/app.py | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/launcher.md b/docs/launcher.md index b05fdb6f..e41048a8 100644 --- a/docs/launcher.md +++ b/docs/launcher.md @@ -55,7 +55,8 @@ Customize Launcher (on the home screen) makes the look the player's own: scheme's backdrop back. - Animations (on by default): the cursor glides from row to row, a new screen slides into place, sparks drift up over the backdrop and Navi bobs in the title band with a pulsing halo (`App.animate`). They move by the time that - passed, stand still while the window is hidden or minimised, and Off stops them all. + passed, stand still while the window is hidden or minimised or another window is in front (the game, when Hide + Launcher While Playing is off), and Off stops them all. - Sounds (Low by default; Off, Medium or High): two of the game's own interface sounds, the decide and cancel sounds of its menus, when a row is chosen or a choice changes and when the player goes back. The launcher decodes them from the player's built game or dump into `data/cache/sounds` (`gamefiles.extract_sounds`: diff --git a/launcher/ui/app.py b/launcher/ui/app.py index 3691d541..93007a4d 100644 --- a/launcher/ui/app.py +++ b/launcher/ui/app.py @@ -1994,14 +1994,16 @@ class App: def animate(self): """One step of everything that moves: the cursor on its way to the focused row and its breath, the screen sliding into place, the sparks and Navi. Each moves by the time since the last step (the timer comes when - Tk gets to it, 16 to 50 ms apart), at most a tenth of a second's worth. With Animations off, and while the - window is hidden or minimised (the game is running), nothing moves and the timer runs slowly.""" + Tk gets to it, 16 to 50 ms apart), at most a tenth of a second's worth. With Animations off, while the + window is hidden or minimised, and while another window is in front, nothing moves and the timer runs slowly. + The last covers a launcher left open behind the game (Hide Launcher While Playing off): drawing every 15 ms + took about 0.6 of a CPU core from the game for a window nobody saw.""" moving = False try: now = time.perf_counter() dt = min(0.1, max(0.0, now - self.anim_last)) self.anim_last = now - moving = self.animated() and self.root.state() == 'normal' + moving = self.animated() and self.root.state() == 'normal' and winsys.in_front(self.root) if moving: self.anim_t += dt self.step_slide(dt)