This repository has been archived on 2024-04-19. You can view files and clone it, but cannot push or open issues or pull requests.
Jessist/Scripts/FPS.gd

35 lines
1 KiB
GDScript3
Raw Permalink Normal View History

2022-06-18 13:05:48 +02:00
######################
### Jessist Script ###
######################
# This script is part of Jessist
# Jessist is licensed under GNU GPLv3
#
# This script manages the FPS counters
extends ColorRect
export var enableFPSCounter = true
export var enableXYCounters = true
export var playerPosition = Vector2(0,0)
func _ready():
gameController.logCall("FPS","_ready",null)
if enableFPSCounter:
gameController.logInfo("FPS","_ready","FPS Counter is activated.")
else:
gameController.logInfo("FPS","_ready","FPS Counter is deactivated.")
if enableXYCounters:
gameController.logInfo("FPS","_ready","XY Counters are activated.")
else:
gameController.logInfo("FPS","_ready","XY Counters are deactivated.")
func _process(delta):
gameController.logCall("FPS","_process",delta)
if enableFPSCounter:
$FPSCounter.set_text("FPS: " + String(Engine.get_frames_per_second()))
else:
$FPSCounter.set_text("")
if enableXYCounters:
$XYCounter.set_text("POS: x" + String(playerPosition.x) + " y" + String(playerPosition.y))
else:
$XYCounter.set_text("")