win quit method
This commit is contained in:
parent
79c55df96b
commit
b29e33f187
@ -55,14 +55,25 @@ func _apply_compatibility() -> void:
|
|||||||
print("[Compatibility] Switching to 'opengl3' rendering driver.")
|
print("[Compatibility] Switching to 'opengl3' rendering driver.")
|
||||||
# 重启游戏以应用新渲染器
|
# 重启游戏以应用新渲染器
|
||||||
var args = ["--rendering-driver", "opengl3"]
|
var args = ["--rendering-driver", "opengl3"]
|
||||||
# 启动新实例
|
|
||||||
var executable_path = OS.get_executable_path()
|
var executable_path = OS.get_executable_path()
|
||||||
OS.create_process(executable_path, args)
|
var result = OS.create_process(executable_path, args)
|
||||||
get_tree().quit()
|
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:
|
elif config.compatibility_mode == 3:
|
||||||
print("[Compatibility] Running on 'non-opengl3' rendering driver.")
|
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:
|
func _apply_debug_mode() -> void:
|
||||||
if config.debug_mode:
|
if config.debug_mode:
|
||||||
GlobalConfig.DEBUG = true
|
GlobalConfig.DEBUG = true
|
||||||
|
Loading…
Reference in New Issue
Block a user