From 2265d3a40eae181b702f0ba652815ffea86c1468 Mon Sep 17 00:00:00 2001 From: godotg Date: Sun, 24 Jul 2022 15:38:08 +0800 Subject: [PATCH] doc --- doc/demo12_gui/gui.md | 4 +-- doc/demo13_camera/camera.md | 45 +++++++++++++++++--------- scene/demo12_gui/anchor.tscn | 18 +++++++++++ scene/demo12_gui/gui.tscn | 10 ++++-- scene/demo13_camera/2.move_camera.tscn | 1 + 5 files changed, 57 insertions(+), 21 deletions(-) diff --git a/doc/demo12_gui/gui.md b/doc/demo12_gui/gui.md index 71e2664..36c7db2 100644 --- a/doc/demo12_gui/gui.md +++ b/doc/demo12_gui/gui.md @@ -34,8 +34,8 @@ - 思源黑体,免费,开源,https://github.com/adobe-fonts/source-han-sans/releases ``` -由Google和Adobe在2014年7月正式推出的开源字体不仅可以免费商用而且全面支持中文简体、中文繁体(香港)、中文繁体(台湾)、日文和韩文,还有七种字体粗细,整个字形个数接近50万。 - +由Google和Adobe在2014年7月正式推出的开源字体, +不仅可以免费商用而且全面支持中文简体、中文繁体(香港)、中文繁体(台湾)、日文和韩文,还有七种字体粗细,整个字形个数接近50万。 免费可商用 ``` diff --git a/doc/demo13_camera/camera.md b/doc/demo13_camera/camera.md index bd033cd..a5453c9 100644 --- a/doc/demo13_camera/camera.md +++ b/doc/demo13_camera/camera.md @@ -1,4 +1,16 @@ -# camera +# 1. Camera2D相机 + +- Godot的 Camera2D 节点,也就是我们说的摄像机,它提供了不少可以定义的属性来处理游戏中的镜头,并且非常简单。 +- 摄像机的作用 + +``` +其实不用添加摄像机,我们的游戏也能够显示出画面来,但是当移动角色时,画面并不会跟着角色移动,正好我们有一个很大的地图,要如何展示呢。 + +摄像机的作用就是做为屏幕可见区域的镜头,让你可以看到它照到的区域部分。当角色移动或是需要展示其它区域时,移动的就是摄像机的镜头。 +``` + +- 同一时间,只可能有一个摄像机处于激活状态。它是自动的,激活一个,其它的都会被置为未激活状态。 + ![Image text](image/camera1.png) ![Image text](image/camera2.png) ![Image text](image/camera3.png) @@ -6,24 +18,25 @@ ![Image text](image/camera5.png) ![Image text](image/camera6.png) +# 2. Viewport可视化窗口实现小窗口 - -# viewport(视口,可视化窗口) - root就是根节点的viewport - ![Image text](image/viewport1.png) - ![Image text](image/viewport2.png) - ![Image text](image/viewport3.png) - ![Image text](image/viewport4.png) - ![Image text](image/viewport5.png) - ![Image text](image/viewport6.png) - ![Image text](image/viewport7.png) - ![Image text](image/viewport8.png) - ![Image text](image/viewport9.png) - ![Image text](image/viewport10.png) - ![Image text](image/viewport11.png) -# canvas layer -- 它是一个节点, 为所有子代和孙代添加一个单独的2D渲染层.Viewport的子节点默认在图层 "0 " 处绘制, 而CanvasLayer将在任何数字层处绘制. +![Image text](image/viewport1.png) +![Image text](image/viewport2.png) +![Image text](image/viewport3.png) +![Image text](image/viewport4.png) +![Image text](image/viewport5.png) +![Image text](image/viewport6.png) +![Image text](image/viewport7.png) +![Image text](image/viewport8.png) +![Image text](image/viewport9.png) +![Image text](image/viewport10.png) +![Image text](image/viewport11.png) + +# 3. CanvasLayer节点 + +- 它是一个节点, 为所有子代和孙代添加一个单独的2D渲染层.Viewport的子节点默认在图层 "0 " 处绘制, 而CanvasLayer将在任何数字层处绘制. - 数字较大的图层将绘制在数字较小的图层之上.CanvasLayers也有自己的变换, 不依赖于其他层的变换. 这使得当我们对游戏世界的观察发生变化时,UI可以固定在屏幕空间中. ![Image text](image/canvaslayers.png) diff --git a/scene/demo12_gui/anchor.tscn b/scene/demo12_gui/anchor.tscn index 77e986a..9459126 100644 --- a/scene/demo12_gui/anchor.tscn +++ b/scene/demo12_gui/anchor.tscn @@ -22,3 +22,21 @@ __meta__ = { margin_right = 44.0 margin_bottom = 20.0 text = "Child" + +[node name="Control" type="Control" parent="."] +margin_left = 55.1478 +margin_top = 233.954 +margin_right = 216.148 +margin_bottom = 344.954 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Label" type="Label" parent="Control"] +margin_right = 105.0 +margin_bottom = 14.0 +rect_pivot_offset = Vector2( 75.7402, 10.9574 ) +text = "aaaaaaaaaaaaaav" +__meta__ = { +"_edit_use_anchors_": false +} diff --git a/scene/demo12_gui/gui.tscn b/scene/demo12_gui/gui.tscn index 7c35b0e..37031db 100644 --- a/scene/demo12_gui/gui.tscn +++ b/scene/demo12_gui/gui.tscn @@ -1,10 +1,13 @@ -[gd_scene load_steps=3 format=2] +[gd_scene load_steps=4 format=2] [ext_resource path="res://scene/demo12_gui/Source_Han_Sans.ttf" type="DynamicFontData" id=1] [sub_resource type="DynamicFont" id=1] font_data = ExtResource( 1 ) +[sub_resource type="DynamicFont" id=2] +font_data = ExtResource( 1 ) + [node name="Node2D" type="Node2D"] [node name="Label" type="Label" parent="."] @@ -13,7 +16,8 @@ margin_top = 20.3757 margin_right = 91.2518 margin_bottom = 44.3757 rect_pivot_offset = Vector2( 37.8167, 12 ) -text = "label1" +custom_fonts/font = SubResource( 1 ) +text = "label1你好" __meta__ = { "_edit_use_anchors_": false } @@ -23,7 +27,7 @@ margin_left = 25.6472 margin_top = 62.6466 margin_right = 143.647 margin_bottom = 86.6466 -custom_fonts/font = SubResource( 1 ) +custom_fonts/font = SubResource( 2 ) text = "有字体的lable" __meta__ = { "_edit_use_anchors_": false diff --git a/scene/demo13_camera/2.move_camera.tscn b/scene/demo13_camera/2.move_camera.tscn index f2667f3..ab94046 100644 --- a/scene/demo13_camera/2.move_camera.tscn +++ b/scene/demo13_camera/2.move_camera.tscn @@ -12,6 +12,7 @@ position = Vector2( -227.193, 239.648 ) texture = ExtResource( 2 ) [node name="icon2" type="Sprite" parent="."] +modulate = Color( 0.054902, 0.533333, 0.815686, 1 ) position = Vector2( 665.147, 246.323 ) texture = ExtResource( 2 )