Skip to content

Commit

Permalink
Update demo
Browse files Browse the repository at this point in the history
  • Loading branch information
TokisanGames committed Oct 24, 2024
1 parent 9312f0a commit 4088dbc
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 19 deletions.
49 changes: 47 additions & 2 deletions project/demo/components/UI.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 8 additions & 4 deletions project/demo/data/assets.tres
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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")])
36 changes: 23 additions & 13 deletions project/demo/src/UI.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ extends Control


var player: Node
var visible_mode: int = 1


func _init() -> void:
Expand All @@ -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
Expand Down

0 comments on commit 4088dbc

Please sign in to comment.