Explorar o código

Merge pull request #67 from aaronfranke/debug

Implement some in-game debug text
Aaron Franke %!s(int64=5) %!d(string=hai) anos
pai
achega
bbd039ac76
Modificáronse 4 ficheiros con 70 adicións e 41 borrados
  1. 9 0
      level/debug.gd
  2. 16 1
      level/level.tscn
  3. 40 40
      menu/menu.tscn
  4. 5 0
      project.godot

+ 9 - 0
level/debug.gd

@@ -0,0 +1,9 @@
+extends Label
+
+func _process(delta):
+	if Input.is_action_just_pressed("toggle_debug"):
+		visible = !visible
+	
+	text = "FPS: " + str(Engine.get_frames_per_second())
+	text += "\nVSync: " + ("on" if ProjectSettings.get_setting("display/window/vsync/use_vsync") else "off")
+	text += "\nMemory: " + "%3.2f" % (OS.get_static_memory_usage() / 1048576.0) + " MiB"

+ 16 - 1
level/level.tscn

@@ -1,4 +1,4 @@
-[gd_scene load_steps=16 format=2]
+[gd_scene load_steps=17 format=2]
 
 [ext_resource path="res://level/level.gd" type="Script" id=1]
 [ext_resource path="res://level/geometry/scenes/props.tscn" type="PackedScene" id=2]
@@ -8,6 +8,7 @@
 [ext_resource path="res://player/player.tscn" type="PackedScene" id=6]
 [ext_resource path="res://enemies/red_robot/red_robot.tscn" type="PackedScene" id=7]
 [ext_resource path="res://level/level_music.ogg" type="AudioStream" id=8]
+[ext_resource path="res://level/debug.gd" type="Script" id=9]
 [ext_resource path="res://level/forklift/flying_forklift.tscn" type="PackedScene" id=12]
 [ext_resource path="res://level/geometry/scenes/lights.tscn" type="PackedScene" id=13]
 [ext_resource path="res://level/geometry/scenes/core.tscn" type="PackedScene" id=14]
@@ -138,3 +139,17 @@ transform = Transform( -1, 0, -1.50996e-07, 0, 1, 0, 1.50996e-07, 0, -1, -68.249
 [node name="AnimationPlayer" type="AnimationPlayer" parent="FlyingForklifts"]
 autoplay = "mawaru"
 anims/mawaru = SubResource( 2 )
+
+[node name="Debug" type="Label" parent="."]
+visible = false
+margin_left = 10.0
+margin_top = 10.0
+margin_right = 40.0
+margin_bottom = 14.0
+text = "FPS: 0
+VSync:
+Memory:"
+script = ExtResource( 9 )
+__meta__ = {
+"_edit_use_anchors_": false
+}

+ 40 - 40
menu/menu.tscn

@@ -19,12 +19,12 @@
 [ext_resource path="res://menu/button_hover.tres" type="StyleBox" id=17]
 [ext_resource path="res://menu/button_action_pressed.tres" type="StyleBox" id=18]
 
-[sub_resource type="PanoramaSky" id=9]
+[sub_resource type="PanoramaSky" id=1]
 panorama = ExtResource( 2 )
 
-[sub_resource type="Environment" id=10]
+[sub_resource type="Environment" id=2]
 background_mode = 3
-background_sky = SubResource( 9 )
+background_sky = SubResource( 1 )
 glow_enabled = true
 glow_levels/7 = true
 glow_intensity = 0.4
@@ -32,9 +32,9 @@ glow_blend_mode = 1
 glow_hdr_threshold = 0.34
 glow_bicubic_upscale = true
 
-[sub_resource type="QuadMesh" id=11]
+[sub_resource type="QuadMesh" id=3]
 
-[sub_resource type="SpatialMaterial" id=12]
+[sub_resource type="SpatialMaterial" id=4]
 albedo_texture = ExtResource( 4 )
 metallic = 0.78
 
@@ -63,7 +63,7 @@ nodes/Eyes/position = Vector2( -40, 220 )
 nodes/output/position = Vector2( 420, 120 )
 node_connections = [ "output", 0, "Blend", "Blend", 0, "CombatRest", "Blend", 1, "Eyes" ]
 
-[sub_resource type="Theme" id=13]
+[sub_resource type="Theme" id=9]
 Button/colors/font_color = Color( 1, 1, 1, 1 )
 Button/colors/font_color_disabled = Color( 0.9, 0.9, 0.9, 0.2 )
 Button/colors/font_color_hover = Color( 1, 1, 1, 1 )
@@ -85,24 +85,24 @@ Label/constants/shadow_offset_y = 1
 Label/fonts/font = ExtResource( 13 )
 Label/styles/normal = null
 
-[sub_resource type="ButtonGroup" id=14]
+[sub_resource type="ButtonGroup" id=10]
 
-[sub_resource type="ButtonGroup" id=15]
+[sub_resource type="ButtonGroup" id=11]
 
-[sub_resource type="ButtonGroup" id=16]
+[sub_resource type="ButtonGroup" id=12]
 
-[sub_resource type="ButtonGroup" id=17]
+[sub_resource type="ButtonGroup" id=13]
 
-[sub_resource type="ButtonGroup" id=18]
+[sub_resource type="ButtonGroup" id=14]
 
-[sub_resource type="DynamicFontData" id=19]
+[sub_resource type="DynamicFontData" id=15]
 font_path = "res://menu/font/PT_Sans-Web-Bold.ttf"
 
-[sub_resource type="DynamicFont" id=20]
+[sub_resource type="DynamicFont" id=16]
 size = 40
-font_data = SubResource( 19 )
+font_data = SubResource( 15 )
 
-[sub_resource type="StyleBoxFlat" id=21]
+[sub_resource type="StyleBoxFlat" id=17]
 bg_color = Color( 0.278431, 0.278431, 0.360784, 1 )
 border_width_left = 5
 border_width_top = 5
@@ -114,7 +114,7 @@ corner_radius_top_right = 10
 corner_radius_bottom_right = 10
 corner_radius_bottom_left = 10
 
-[sub_resource type="StyleBoxFlat" id=22]
+[sub_resource type="StyleBoxFlat" id=18]
 bg_color = Color( 0.0901961, 0.0784314, 0.117647, 1 )
 border_width_left = 3
 border_width_top = 3
@@ -130,7 +130,7 @@ corner_radius_bottom_left = 10
 script = ExtResource( 1 )
 
 [node name="WorldEnvironment" type="WorldEnvironment" parent="."]
-environment = SubResource( 10 )
+environment = SubResource( 2 )
 
 [node name="PlayerModel" parent="." instance=ExtResource( 3 )]
 
@@ -149,8 +149,8 @@ __meta__ = {
 
 [node name="Floor" type="MeshInstance" parent="."]
 transform = Transform( 15, 0, 0, 0, 0, 15, 0, -15, 0, 0, 0, 0 )
-mesh = SubResource( 11 )
-material/0 = SubResource( 12 )
+mesh = SubResource( 3 )
+material/0 = SubResource( 4 )
 
 [node name="SpotLight" type="SpotLight" parent="."]
 transform = Transform( 0.967027, 0, 0.254675, -0.225291, 0.466312, 0.855452, -0.118758, -0.88462, 0.450936, 0.557445, 2.31204, 0.556668 )
@@ -184,7 +184,7 @@ __meta__ = {
 anchor_left = 0.00106799
 anchor_right = 1.00107
 anchor_bottom = 1.0
-theme = SubResource( 13 )
+theme = SubResource( 9 )
 __meta__ = {
 "_edit_use_anchors_": false
 }
@@ -267,7 +267,7 @@ margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
 pressed = true
-group = SubResource( 14 )
+group = SubResource( 10 )
 text = "High"
 
 [node name="Low" type="Button" parent="UI/Settings/GI"]
@@ -276,7 +276,7 @@ margin_right = 1028.0
 margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
-group = SubResource( 14 )
+group = SubResource( 10 )
 text = "Low"
 
 [node name="Disabled" type="Button" parent="UI/Settings/GI"]
@@ -285,7 +285,7 @@ margin_right = 1342.0
 margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
-group = SubResource( 14 )
+group = SubResource( 10 )
 text = "Disabled"
 
 [node name="AA" type="HBoxContainer" parent="UI/Settings"]
@@ -313,7 +313,7 @@ margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
 pressed = true
-group = SubResource( 15 )
+group = SubResource( 11 )
 text = "8x"
 
 [node name="4X" type="Button" parent="UI/Settings/AA"]
@@ -322,7 +322,7 @@ margin_right = 870.0
 margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
-group = SubResource( 15 )
+group = SubResource( 11 )
 text = "4x"
 
 [node name="2X" type="Button" parent="UI/Settings/AA"]
@@ -331,7 +331,7 @@ margin_right = 1105.0
 margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
-group = SubResource( 15 )
+group = SubResource( 11 )
 text = "2x"
 
 [node name="Disabled" type="Button" parent="UI/Settings/AA"]
@@ -340,7 +340,7 @@ margin_right = 1342.0
 margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
-group = SubResource( 15 )
+group = SubResource( 11 )
 text = "Disabled"
 
 [node name="SSAO" type="HBoxContainer" parent="UI/Settings"]
@@ -370,7 +370,7 @@ margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
 pressed = true
-group = SubResource( 16 )
+group = SubResource( 12 )
 text = "High"
 
 [node name="Low" type="Button" parent="UI/Settings/SSAO"]
@@ -379,7 +379,7 @@ margin_right = 1028.0
 margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
-group = SubResource( 16 )
+group = SubResource( 12 )
 text = "Low"
 
 [node name="Disabled" type="Button" parent="UI/Settings/SSAO"]
@@ -388,7 +388,7 @@ margin_right = 1342.0
 margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
-group = SubResource( 16 )
+group = SubResource( 12 )
 text = "Disabled"
 
 [node name="Resolution" type="HBoxContainer" parent="UI/Settings"]
@@ -418,7 +418,7 @@ margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
 pressed = true
-group = SubResource( 17 )
+group = SubResource( 13 )
 text = "Native"
 
 [node name="1080" type="Button" parent="UI/Settings/Resolution"]
@@ -427,7 +427,7 @@ margin_right = 870.0
 margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
-group = SubResource( 17 )
+group = SubResource( 13 )
 text = "1080"
 
 [node name="720" type="Button" parent="UI/Settings/Resolution"]
@@ -436,7 +436,7 @@ margin_right = 1105.0
 margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
-group = SubResource( 17 )
+group = SubResource( 13 )
 text = "720"
 
 [node name="540" type="Button" parent="UI/Settings/Resolution"]
@@ -445,7 +445,7 @@ margin_right = 1342.0
 margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
-group = SubResource( 17 )
+group = SubResource( 13 )
 text = "540"
 
 [node name="Fullscreen" type="HBoxContainer" parent="UI/Settings"]
@@ -472,7 +472,7 @@ margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
 pressed = true
-group = SubResource( 18 )
+group = SubResource( 14 )
 text = "Yes"
 
 [node name="No" type="Button" parent="UI/Settings/Fullscreen"]
@@ -481,7 +481,7 @@ margin_right = 1342.0
 margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
-group = SubResource( 18 )
+group = SubResource( 14 )
 text = "No"
 
 [node name="HSeparator" type="HSeparator" parent="UI/Settings"]
@@ -503,7 +503,7 @@ margin_bottom = 57.0
 size_flags_horizontal = 3
 custom_styles/hover = ExtResource( 18 )
 custom_styles/pressed = ExtResource( 18 )
-custom_fonts/font = SubResource( 20 )
+custom_fonts/font = SubResource( 16 )
 custom_colors/font_color = Color( 1, 1, 1, 1 )
 custom_colors/font_color_hover = Color( 1, 1, 1, 1 )
 custom_colors/font_color_pressed = Color( 1, 1, 1, 1 )
@@ -519,7 +519,7 @@ margin_bottom = 57.0
 size_flags_horizontal = 3
 custom_styles/hover = ExtResource( 18 )
 custom_styles/pressed = ExtResource( 18 )
-custom_fonts/font = SubResource( 20 )
+custom_fonts/font = SubResource( 16 )
 custom_colors/font_color = Color( 1, 1, 1, 1 )
 custom_colors/font_color_hover = Color( 1, 1, 1, 1 )
 custom_colors/font_color_pressed = Color( 1, 1, 1, 1 )
@@ -552,8 +552,8 @@ margin_right = 1690.0
 margin_bottom = 53.0
 size_flags_horizontal = 3
 size_flags_vertical = 1
-custom_styles/fg = SubResource( 21 )
-custom_styles/bg = SubResource( 22 )
+custom_styles/fg = SubResource( 17 )
+custom_styles/bg = SubResource( 18 )
 __meta__ = {
 "_edit_use_anchors_": false
 }

+ 5 - 0
project.godot

@@ -193,6 +193,11 @@ toggle_fullscreen={
 , Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777254,"unicode":0,"echo":false,"script":null)
  ]
 }
+toggle_debug={
+"deadzone": 0.5,
+"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777246,"unicode":0,"echo":false,"script":null)
+ ]
+}
 
 [layer_names]