Page 4 of 5

Re: [library] cron.lua - time management for LÖVE - v2.0 is

Posted: Sun May 04, 2014 3:42 pm
by kikito
I am sorry but you will have to give me a little more than that.
  • What did you expect to happen, where?
  • What has happened instead?
  • What have you tried?

Re: [library] cron.lua - time management for LÖVE - v2.0 is

Posted: Sun May 04, 2014 4:44 pm
by Kasperelo
1. I expected the screen to shake.
2. An error.
3. Asking you, since I don't know anything about cron.lua.

Re: [library] cron.lua - time management for LÖVE - v2.0 is

Posted: Sun May 04, 2014 5:34 pm
by kikito
I am sorry but I don't have time to dig through your code right now - especially with so little direction. Perhaps others in the community will want to step in.

Re: [library] cron.lua - time management for LÖVE - v2.0 is

Posted: Mon May 05, 2014 5:16 am
by Jasoco
I don't think the problem lies with cron. I suspect it's a defective shake function. Have you tried testing to make sure the shake works by itself? Attach it to a key press for testing.

Re: [library] cron.lua - time management for LÖVE - v2.0 is

Posted: Thu Jun 05, 2014 10:58 am
by SiENcE
Is it possible to get access to dt in the callback function? When I look at the code, only args are passed, but not dt.

Re: [library] cron.lua - time management for LÖVE - v2.0 is

Posted: Thu Jun 05, 2014 12:18 pm
by Tanner
SiENcE wrote:Is it possible to get access to dt in the callback function? When I look at the code, only args are passed, but not dt.
What would dt be in the context of a cron callback? Wouldn't it just be the interval that you specified?

Re: [library] cron.lua - time management for LÖVE - v2.0 is

Posted: Fri Jun 06, 2014 6:12 am
by kikito
The callback is invoked after many dts. Which one would you pass to the callback? The last one?

Re: [library] cron.lua - time management for LÖVE - v2.0 is

Posted: Fri Jun 06, 2014 7:45 am
by SiENcE
Yes, the last one.

Re: [library] cron.lua - time management for LÖVE - v2.0 is

Posted: Fri Jun 06, 2014 4:42 pm
by Rockford
Are you wanting to pass dt through so it can be used by the function that is being triggered by the cron?

Re: [library] cron.lua - time management for LÖVE - v2.0 is

Posted: Fri Jun 06, 2014 8:17 pm
by kikito
SiENcE wrote:Yes, the last one.
You can use a table to hold a reference to it then. For example, a player table:

Code: Select all

local clock = cron.after(5, function()
  print(player.last_dt)
end)

...

function love.update(dt)
  player.last_dt = dt
  clock:update(dt)
end
The only other option I can think of is overriding clock.update yourself to use dt.