From 75837701ee3d8b0c3b80f813fd6aeb5fd5d2c813 Mon Sep 17 00:00:00 2001 From: PJ568 Date: Fri, 16 Feb 2024 16:47:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=AA=97=E5=8F=A3=E5=A4=A7?= =?UTF-8?q?=E5=B0=8F=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Scripts/全局.gd | 4 +++- project.godot | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) 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