added a quick and dirty fps counter (press F4 or R3 on controller, for it to be toggled)

This commit is contained in:
JoeMama
2025-10-11 22:48:52 +01:00
parent 01238a0f1c
commit efe3b98aa0
3 changed files with 25 additions and 1 deletions

View File

@@ -308,6 +308,20 @@ libraries = {
[node name="GameHUD" parent="." instance=ExtResource("1_ctvpw")]
layer = 1
[node name="FPSCount" type="Label" parent="GameHUD"]
unique_name_in_owner = true
anchors_preset = 3
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -56.0
offset_top = -16.0
grow_horizontal = 0
grow_vertical = 0
text = "120FPS"
horizontal_alignment = 2
[node name="ScoreTally" type="AudioStreamPlayer" parent="."]
stream = ExtResource("3_vjpdy")
bus = &"SFX"
@@ -428,7 +442,7 @@ metadata/_custom_type_script = "uid://ctsjagoa5t33f"
[node name="TextShadowColourChanger" type="Node" parent="." node_paths=PackedStringArray("labels")]
script = ExtResource("19_l7dvb")
labels = [NodePath("../CanvasLayer/VBoxContainer/ErrorMessage"), NodePath("../CanvasLayer/VBoxContainer/Comment"), NodePath("../CanvasLayer/VBoxContainer/Warning")]
labels = [NodePath("../CanvasLayer/VBoxContainer/ErrorMessage"), NodePath("../CanvasLayer/VBoxContainer/Comment"), NodePath("../CanvasLayer/VBoxContainer/Warning"), NodePath("../GameHUD/FPSCount")]
metadata/_custom_type_script = "uid://dt2p68xl462v2"
[connection signal="finished" from="ScoreTally" to="." method="on_score_sfx_finished"]

View File

@@ -245,6 +245,10 @@ func _process(delta: float) -> void:
AudioManager.current_level_theme = ""
level_theme_changed.emit()
log_comment("Reloaded resource packs!")
if Input.is_action_just_pressed("toggle_fps_count"):
%FPSCount.visible = !%FPSCount.visible
%FPSCount.text = str(int(Engine.get_frames_per_second())) + " FPS"
handle_p_switch(delta)
if Input.is_key_label_pressed(KEY_F11) and debug_mode == false and OS.is_debug_build():

View File

@@ -484,6 +484,12 @@ ui_screenshot={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194333,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
toggle_fps_count={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194335,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":4,"pressure":0.0,"pressed":false,"script":null)
]
}
[internationalization]