From 92ba3725287ed47eeaf429b8d54c6bbdb472137b Mon Sep 17 00:00:00 2001 From: Cory Petkovsek <632766+TokisanGames@users.noreply.github.com> Date: Fri, 18 Oct 2024 02:31:41 +0700 Subject: [PATCH] Update demo --- project/demo/components/UI.tscn | 49 +++++++++++++++++++++++++++++++-- project/demo/data/assets.tres | 12 +++++--- project/demo/src/UI.gd | 36 +++++++++++++++--------- 3 files changed, 78 insertions(+), 19 deletions(-) diff --git a/project/demo/components/UI.tscn b/project/demo/components/UI.tscn index 5a82cf4e4..e36d60469 100644 --- a/project/demo/components/UI.tscn +++ b/project/demo/components/UI.tscn @@ -14,8 +14,53 @@ script = ExtResource("1_why5e") [node name="Label" type="Label" parent="."] unique_name_in_owner = true layout_mode = 1 -offset_right = 40.0 -offset_bottom = 23.0 +offset_left = 5.0 +offset_top = 5.0 +offset_right = 275.0 +offset_bottom = 340.0 theme_override_colors/font_shadow_color = Color(0, 0, 0, 0.662745) theme_override_constants/shadow_offset_x = 1 theme_override_constants/shadow_offset_y = 1 +text = "FPS: 100 +Position: (100, 100, 100) +Move Speed: 10 + +Player +Move: WASDEQ,Space,Mouse +Move speed: Wheel,+/-,Shift +Camera view: V +Gravity toggle: G +Collision toggle: C + +Window +Quit: F8 +UI toggle: F9 +Render mode: F10 +Full screen: F11 +Mouse toggle: Escape +" + +[node name="Panel" type="Panel" parent="Label"] +modulate = Color(1, 1, 1, 0.392157) +show_behind_parent = true +layout_mode = 0 +offset_left = -5.0 +offset_top = -5.0 +offset_right = 248.0 +offset_bottom = 444.0 + +[node name="HSeparator" type="HSeparator" parent="Label/Panel"] +top_level = true +layout_mode = 0 +offset_left = 6.0 +offset_top = 129.0 +offset_right = 246.0 +offset_bottom = 138.0 + +[node name="HSeparator2" type="HSeparator" parent="Label/Panel"] +top_level = true +layout_mode = 0 +offset_left = 6.0 +offset_top = 310.0 +offset_right = 246.0 +offset_bottom = 319.0 diff --git a/project/demo/data/assets.tres b/project/demo/data/assets.tres index 9004e88e4..cf1416b09 100644 --- a/project/demo/data/assets.tres +++ b/project/demo/data/assets.tres @@ -5,16 +5,20 @@ [ext_resource type="Texture2D" uid="uid://ddprscrpsofah" path="res://demo/assets/textures/ground037_alb_ht.png" id="3_g8f2m"] [ext_resource type="Texture2D" uid="uid://c1ots7w6i0i1q" path="res://demo/assets/textures/ground037_nrm_rgh.png" id="4_aw5y1"] -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_6fvgb"] +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_aubfq"] +transparency = 4 cull_mode = 2 vertex_color_use_as_albedo = true backlight_enabled = true backlight = Color(0.5, 0.5, 0.5, 1) +distance_fade_mode = 1 +distance_fade_min_distance = 960.0 +distance_fade_max_distance = 480.0 -[sub_resource type="Terrain3DMeshAsset" id="Terrain3DMeshAsset_xqljq"] +[sub_resource type="Terrain3DMeshAsset" id="Terrain3DMeshAsset_dw1mh"] height_offset = 0.5 density = 10.0 -material_override = SubResource("StandardMaterial3D_6fvgb") +material_override = SubResource("StandardMaterial3D_aubfq") generated_type = 1 [sub_resource type="Terrain3DTextureAsset" id="Terrain3DTextureAsset_mup2f"] @@ -31,5 +35,5 @@ albedo_texture = ExtResource("3_g8f2m") normal_texture = ExtResource("4_aw5y1") [resource] -mesh_list = Array[Terrain3DMeshAsset]([SubResource("Terrain3DMeshAsset_xqljq")]) +mesh_list = Array[Terrain3DMeshAsset]([SubResource("Terrain3DMeshAsset_dw1mh")]) texture_list = Array[Terrain3DTextureAsset]([SubResource("Terrain3DTextureAsset_mup2f"), SubResource("Terrain3DTextureAsset_od0q7")]) diff --git a/project/demo/src/UI.gd b/project/demo/src/UI.gd index 12cd2f99e..9c6fbb5f0 100644 --- a/project/demo/src/UI.gd +++ b/project/demo/src/UI.gd @@ -2,6 +2,7 @@ extends Control var player: Node +var visible_mode: int = 1 func _init() -> void: @@ -10,26 +11,35 @@ func _init() -> void: func _process(p_delta) -> void: $Label.text = "FPS: %s\n" % str(Engine.get_frames_per_second()) - $Label.text += "Move Speed: %.1f\n" % player.MOVE_SPEED if player else "" - $Label.text += "Position: %.1v\n" % player.global_position if player else "" - $Label.text += "Move: WASDEQ/Space/Shift/Mouse\n" - $Label.text += "Move speed: Wheel,+/-\n" - $Label.text += "Camera View: V\n" - $Label.text += "Gravity toggle: G\n" - $Label.text += "Collision toggle: C\n" - $Label.text += "Hide UI: H\n" - $Label.text += "Full screen: F11\n" - $Label.text += "Mouse toggle: Escape\n" - $Label.text += "Quit: F8\n" + if(visible_mode == 1): + $Label.text += "Move Speed: %.1f\n" % player.MOVE_SPEED if player else "" + $Label.text += "Position: %.1v\n" % player.global_position if player else "" + $Label.text += """ + Player + Move: WASDEQ,Space,Mouse + Move speed: Wheel,+/-,Shift + Camera View: V + Gravity toggle: G + Collision toggle: C + + Window + Quit: F8 + UI toggle: F9 + Render mode: F10 + Full screen: F11 + Mouse toggle: Escape + """ func _unhandled_key_input(p_event: InputEvent) -> void: if p_event is InputEventKey and p_event.pressed: match p_event.keycode: - KEY_H: - visible = ! visible KEY_F8: get_tree().quit() + KEY_F9: + visible_mode = (visible_mode + 1 ) % 3 + $Label/Panel.visible = (visible_mode == 1) + visible = visible_mode > 0 KEY_F10: var vp = get_viewport() vp.debug_draw = (vp.debug_draw + 1 ) % 6