Is there any difference in using dt and timer.getDelta?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Zarty55
Citizen
Posts: 79
Joined: Thu Jul 25, 2013 2:36 am

Is there any difference in using dt and timer.getDelta?

Post by Zarty55 »

I'm doing a project, where I will have to use timer.getDelta instead of dT. But only in some special cases, is there anything I should be worried about? I mean, the dT argument passed in the update function only has 4 digits, will there be any performance issues if I use timer.getDelta?

Just out of curiosity really, not a problem right now.
User avatar
YGOFreak1997
Party member
Posts: 103
Joined: Sun Jan 22, 2012 4:29 pm
Location: Germany, Baden-Württemberg
Contact:

Re: Is there any difference in using dt and timer.getDelta?

Post by YGOFreak1997 »

For your question - try it out by printing them, but I don't think there is.

I'm a bit interested: Why won't you use dt?
Also look at my LÖVE-Tutorial-Youtube-Channel (German ^^)
GitHub Repo: Click Me!
Website: No, Me!
IndieDB: Or Maybe Me?

ÖBEY!
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Is there any difference in using dt and timer.getDelta?

Post by bartbes »

As you can see in [wiki]love.run[/wiki], dt is obtained by calling love.timer.getDelta, so no, there is no difference.
User avatar
Inny
Party member
Posts: 652
Joined: Fri Jan 30, 2009 3:41 am
Location: New York

Re: Is there any difference in using dt and timer.getDelta?

Post by Inny »

Going one layer deeper, we can see in the Love Timer.cpp source code* that getDelta returns an internal dt value, which is computed above in Timer::step, so the performance hit is quite literally the difference between a local value being passed around, and a single function call.

* https://bitbucket.org/rude/love/src/524 ... ult#cl-120
Zarty55
Citizen
Posts: 79
Joined: Thu Jul 25, 2013 2:36 am

Re: Is there any difference in using dt and timer.getDelta?

Post by Zarty55 »

bartbes wrote:As you can see in [wiki]love.run[/wiki], dt is obtained by calling love.timer.getDelta, so no, there is no difference.
Ohhh, I see. love.timer.getDelta is now microsecond-accurate, yeah. Thank you guys for answering this stupid question. Sorry to bother.

Ygo, right now, I'm asking myself the same question, I think sometimes I just get dumb out of nowhere (Or I'm dumb, really) haha; Still, problem solved xD
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest