win quit method

This commit is contained in:
cakipaul 2025-07-22 00:37:12 +08:00
parent 79c55df96b
commit b29e33f187

View File

@ -55,14 +55,25 @@ func _apply_compatibility() -> void:
print("[Compatibility] Switching to 'opengl3' rendering driver.")
# 重启游戏以应用新渲染器
var args = ["--rendering-driver", "opengl3"]
# 启动新实例
var executable_path = OS.get_executable_path()
OS.create_process(executable_path, args)
get_tree().quit()
var result = OS.create_process(executable_path, args)
if result == OK:
if OS.get_name() == "Windows":
# 使用线程来延迟退出
var thread = Thread.new()
thread.start(_delayed_quit)
else:
get_tree().quit()
elif config.compatibility_mode == 3:
print("[Compatibility] Running on 'non-opengl3' rendering driver.")
func _delayed_quit() -> void:
OS.delay_msec(500) # 等待 500 毫秒
OS.kill(OS.get_process_id())
get_tree().quit()
func _apply_debug_mode() -> void:
if config.debug_mode:
GlobalConfig.DEBUG = true