From 41e76d5bb0ff60eb2a682707dc4c18a2cb240aff Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Mon, 26 Jun 2023 20:07:19 +0200 Subject: [PATCH] Added get_{fps,delta,frametime}() functions --- wmgr.gd | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/wmgr.gd b/wmgr.gd index afe845b..4017d15 100644 --- a/wmgr.gd +++ b/wmgr.gd @@ -17,6 +17,11 @@ var window_title = core.config.wmgr_title @onready var window_mode = core.config.wmgr_mode +var delta = 0 + +func _process(deltap) -> void: + delta = deltap + func set_size(x:int,y:int) -> void: Logger.info("wmgr","Applying new window size (" + str(x) + "x" + str(y) + ")") DisplayServer.window_set_size(Vector2i(x,y)) @@ -63,6 +68,18 @@ func get_mode() -> String: Logger.error("wmgr","Failed to get window mode: The window mode id \"" + str(DisplayServer.window_get_mode()) + "\" is not known to CORE.") return "INVALID_MODE" +func get_fps() -> String: + if str(delta) == "0": + game_fps = INF + else: + game_fps = 1/delta + +func get_rendertime() -> float: + return Performance.get_monitor(Performance.TIME_PROCESS) + +get_delta() -> float: + return delta + func _ready() -> void: Logger.info("wmgr","Configuring window") DisplayServer.window_set_size(Vector2i(window_size_x,window_size_y))