get_window().size = Vector2(320, 240) Run Code Online (Sandbox Code Playgroud) 或者视口: get_viewport().size = Vector2(320, 240) Run Code Online (Sandbox Code Playgroud) 要确定您可以使用的平台OS.get_name(): prints(OS.get_name()) ...
ps = p.size a = DisplayServer.window_get_size() func _process(delta): #修改PopupMenu的大小和缩放比例 b = DisplayServer.window_get_size() c = min(b.x/a.x,b.y/a.y) p.size = ps*c #修改大小 p.content_scale_factor = c #修改放缩比例...
在任意gd代码下使用get_viewport_rect().size可获得设计尺寸 大家有兴趣可以试试下面代码,这是用ColorRect绘制了一个屏幕中心的坐标,使用OS.window_size和get_viewport_rect().size两种方法分别看看效果 #tool extends ColorRectfunc_draw():#varwinSize=get_viewport_rect().sizevarwinSize=OS.window_sizedraw_re...
onready var _windowSize := self.get_viewport_rect().size # 跟踪的目标 var targets := [] func _process(delta: float) -> void: if targets.size() <= 1: _camera.zoom = lerp(_camera.zoom, Vector2.ONE, 2.0 * delta) return var minPos := _windowSize # 最小位置点 var maxPos := ...
onready var _windowSize := self.get_viewport_rect().size # 跟踪的目标 var targets := [] func _process(delta: float) -> void: if targets.size() <= 1: _camera.zoom = lerp(_camera.zoom, Vector2.ONE, 2.0 * delta) return
# 窗口大小onready var _windowSize:=self.get_viewport_rect().size# 跟踪的目标var targets:=[]func _process(delta:float)->void:iftargets.size()<=1:_camera.zoom=lerp(_camera.zoom,Vector2.ONE,2.0*delta)returnvar minPos:=_windowSize# 最小位置点var maxPos:=Vector2.ZERO# 最大位置点fortarge...
Fixes Change window size at runtime will shrink viewport size in android #98088 👍 2 Fix root window size bug on Android 3f021e2 syntaxerror247 marked this pull request as ready for review November 25, 2024 09:26 syntaxerror247 requested a review from a team as a code owner Novemb...
There are several inconsistencies and bugs with the way godot determines the minimum and current window size. Here, a scaling factor of 2 causes godot to discard the values set from DisplayServer.window_set_min_size, as soon as wrap_content is set to true. This issue only exists when a ...
extendsArea2Dsignalhit#自定义hit信号,碰撞时候发出#export将会让变量也在编辑器中显示exportvarspeed=400# 设置速度.varscreen_size# 窗口大小.#进入该场景即触发 _ready()func_ready():screen_size=get_viewport_rect().size#查找窗口hide()#默认开始时隐藏Player#空闲处理func_process(delta)://计算移动向量var...
其实相机的宽高就是画面的大小,可以用Viewport的宽高(get_tree().root.size)或者窗口大小(OS.window_size) 别再折磨黄瓜了 着色器 6 嗯,我其实不想用CanvasLayer来做飘字的,但是ui好像没用zindex的属性,我试了下,只要其它节点的zindex超过2就会遮住ui,不知道有没有办法修改ui的默认zindex。 别再折磨黄瓜...