ui: clean raylib even on SIGINT (#36368)

* fix

* keep

* fix
This commit is contained in:
Maxime Desroches
2025-10-15 17:03:49 -07:00
committed by GitHub
parent ec33519dc7
commit 530ad2925d
+7 -1
View File
@@ -2,6 +2,8 @@ import atexit
import cffi
import os
import time
import signal
import sys
import pyray as rl
import threading
from collections.abc import Callable
@@ -154,7 +156,11 @@ class GuiApplication:
self._window_close_requested = True
def init_window(self, title: str, fps: int = _DEFAULT_FPS):
atexit.register(self.close) # Automatically call close() on exit
def _close(sig, frame):
self.close()
sys.exit(0)
signal.signal(signal.SIGINT, _close)
atexit.register(self.close)
HARDWARE.set_display_power(True)
HARDWARE.set_screen_brightness(65)