This repository has been archived on 2022-01-09. You can view files and clone it, but cannot push or open issues/pull-requests.
liblast/Game/Assets/HUD/Performance.gd

28 lines
720 B
GDScript

extends Label
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
@onready var main = get_tree().root.get_node("Main")
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if not get_tree().multiplayer.has_multiplayer_peer():
text = "Offline"
elif get_tree().multiplayer.is_server():
text = "Hosting"
else:
if main.ping_time >= 0:
text = "Ping: " + str(round(main.ping_time * 1000)) + " ms"
else:
text = "Ping unknown"
text += "\nFPS: " + str(Engine.get_frames_per_second())
text += "\nLiblast 0.1.1 pre-alpha"