Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Callback Order Inconsistancy #19

Closed
josefnpat opened this issue May 26, 2013 · 3 comments
Closed

Callback Order Inconsistancy #19

josefnpat opened this issue May 26, 2013 · 3 comments

Comments

@josefnpat
Copy link

So I was using the infamous gamestate library, and I stumbled across something odd;

The order that the callbacks are executed in don't seem to correlate with love's callbacks;

In love, the love.update is called before love.draw, whereas when gamestate has a foo:update and foo:draw, it calls foo:draw first, then foo:update.

This Inconsistancy threw me off, and if possible, it would be nice if reversed.

My current workaround is to use :init or :enter to set the variables before the library :draw's.

@vrld
Copy link
Owner

vrld commented May 27, 2013

That's odd, because hump simply injects inself into the love callbacks, similar to this:

local _update = love.update
function love.update(dt)
    _update(dt)
    GS.update(dt)
end

Do you call GS.switch() inside love.update() or state:update()?

@josefnpat
Copy link
Author

I do call love.update(), which means I am screwing up the state context; so in the end, this is my fault.

I thought gamestate would finish up the state as is, and it would switch the state once the whole love.run loop finished; so this would be user error.

Would that make sense as a feature request, to ask gamestate to finish up the current callbacks for the "cycle", and then switch after?

@vrld
Copy link
Owner

vrld commented May 30, 2015

Should be fixed by 3c666c5

@vrld vrld closed this as completed May 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants