Wikipedia: “Delta Time or Delta Timing is a concept used amongst programmers in relation to hardware and network responsiveness. In graphics programming, the term is usually used for variably updating scenery based on the elapsed time since the game last updated (i.e. the previous “frame”) which will vary depending on the speed of the computer, and how much work needs to be done in the game at any given time.”
Defold- examples: “Increase the elapsed time with dt, the delta time elapsed since last call to update().”
If that is true then you could make a script like this:
local f = gui.get_node("FPS")
gui.set_text(f,"FPS : " .. math.floor(1 / dt + 0.5))
but it never changes because the dt is exactly 1/60 <- 60 is the given framrate
Insted you have to make something like this for it to work:
local deltatime = os.clock() - self.time
self.time = os.clock()
local f = gui.get_node("FPS")
gui.set_text(f,"FPS : " .. math.floor(1 / deltatime + 0.5))
Can someone fix this or tell me if I have understood something wrong.