Skip to content

Instantly share code, notes, and snippets.

@brettchalupa
Created April 11, 2023 13:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brettchalupa/4dd3107163da29a8158c3cdb4974d521 to your computer and use it in GitHub Desktop.
Save brettchalupa/4dd3107163da29a8158c3cdb4974d521 to your computer and use it in GitHub Desktop.
Godot 4 Frames Per Second Explained
extends Node2D
const FPS_DICTIONARY = {
0: 0,
1: 60,
2: 30,
}
func _ready() -> void:
set_max_fps_text()
func set_max_fps_text():
$MaxFPS.text = "Max FPS: " + str(Engine.max_fps)
func _process(delta: float) -> void:
$CurrentFPS.text = "Current FPS: " + str(Engine.get_frames_per_second())
func _on_fps_dropdown_item_selected(index: int) -> void:
Engine.max_fps = FPS_DICTIONARY[index]
set_max_fps_text()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment