Added get_{fps,delta,frametime}() functions

This commit is contained in:
JeremyStar™ 2023-06-26 20:07:19 +02:00
parent 681e07715f
commit 41e76d5bb0

17
wmgr.gd
View file

@ -17,6 +17,11 @@ var window_title = core.config.wmgr_title
@onready @onready
var window_mode = core.config.wmgr_mode var window_mode = core.config.wmgr_mode
var delta = 0
func _process(deltap) -> void:
delta = deltap
func set_size(x:int,y:int) -> void: func set_size(x:int,y:int) -> void:
Logger.info("wmgr","Applying new window size (" + str(x) + "x" + str(y) + ")") Logger.info("wmgr","Applying new window size (" + str(x) + "x" + str(y) + ")")
DisplayServer.window_set_size(Vector2i(x,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.") 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" 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: func _ready() -> void:
Logger.info("wmgr","Configuring window") Logger.info("wmgr","Configuring window")
DisplayServer.window_set_size(Vector2i(window_size_x,window_size_y)) DisplayServer.window_set_size(Vector2i(window_size_x,window_size_y))