Skip to content

Commit

Permalink
Review and improve the DebugManager for #15.
Browse files Browse the repository at this point in the history
  • Loading branch information
Makosai committed Apr 8, 2024
1 parent f555bcf commit be021dc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
12 changes: 6 additions & 6 deletions godot/scenes/misc/managers.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@

[node name="Managers" type="Node"]

[node name="GameManager" type="Node" parent="."]
script = ExtResource("1_scrx5")

[node name="UIManager" type="Node" parent="."]
script = ExtResource("2_ebcnw")

[node name="DebugManager" type="Node" parent="."]
script = ExtResource("2_h5l7x")

Expand All @@ -23,6 +17,12 @@ offset_right = 113.0
offset_bottom = 40.0
text = "FPS: N/A"

[node name="GameManager" type="Node" parent="."]
script = ExtResource("1_scrx5")

[node name="UIManager" type="Node" parent="."]
script = ExtResource("2_ebcnw")

[node name="DiscordManager" type="Node" parent="."]
script = ExtResource("4_gpq3t")

Expand Down
11 changes: 7 additions & 4 deletions godot/scenes/misc/scripts/managers/debug_manager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class_name DebugManager extends Node

var debugging = true # debug option

const FPS_TIMER_LIMIT = 2.0
const FPS_TIMER_LIMIT = 2.0 # delay for FPS update
var fps_debug = true # debug option
var fps_timer = 0.0
@onready var fps_counter = $"FPSCounter";
Expand All @@ -22,9 +22,12 @@ func _process(delta):

fps_counter.set_text("FPS: " + str(Engine.get_frames_per_second()).pad_decimals(2))

###
### Toggles
###
## Toggles debugging and the process mode.
func debug():
debugging = !debugging
process_mode = Node.PROCESS_MODE_DISABLED if !debugging else Node.PROCESS_MODE_INHERIT

### Toggles the FPS counter.
func debug_fps():
fps_debug = !fps_debug
fps_counter.visible = fps_debug

0 comments on commit be021dc

Please sign in to comment.