diff --git a/Scripts/全局.gd b/Scripts/全局.gd index 6a452e0..03f4ce9 100644 --- a/Scripts/全局.gd +++ b/Scripts/全局.gd @@ -88,6 +88,8 @@ func 初始化语言设置(): func 改变初始窗口大小(): + # 获取系统类型 var sys_name := OS.get_name() - if sys_name != "Android" and sys_name != "iOS" and sys_name != "Web": + # 根据系统类型判断是否调整窗口DPI + if sys_name == "Windows" or sys_name == "macOS" or sys_name == "Linux" or sys_name == "BSD": get_viewport().size = Vector2(DisplayServer.screen_get_dpi() * 3.5, DisplayServer.screen_get_dpi() * 6.2) diff --git a/project.godot b/project.godot index bc0ca8a..2fdb303 100644 --- a/project.godot +++ b/project.godot @@ -27,6 +27,7 @@ Global="*res://Scripts/全局.gd" window/size/viewport_width=720 window/size/viewport_height=1220 +window/size/initial_position_type=3 window/stretch/mode="canvas_items" window/stretch/aspect="expand" window/handheld/orientation=1