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

Pre/Post Update and Draw signals should include elapsed #1836

Closed
Tracked by #2538
JoeCreates opened this issue Apr 26, 2016 · 9 comments
Closed
Tracked by #2538

Pre/Post Update and Draw signals should include elapsed #1836

JoeCreates opened this issue Apr 26, 2016 · 9 comments
Milestone

Comments

@JoeCreates
Copy link
Member

JoeCreates commented Apr 26, 2016

Pre/Post Update and Draw signals should include elapsed. This time will always be calculated by the time the calls are required, and this information is useful in many cases, such as doing late updates to physics.

It seems FlxG.elapsed could be used in most cases, but not in the case of preUpdate because elapsed isn't calculated until after preUpdate is dispatched.

If the value is passed instead, it would also make the listeners more flexible.

@Gama11
Copy link
Member

Gama11 commented Apr 26, 2016

Hm, this is unfortunately a breaking change...

I think we had those signals before there was an elapsed argument in update().

@JoeCreates
Copy link
Member Author

As an intermiary non-breaking improvement, the dispatch of the preupdate could be moved to after calculation of FlxG.elapsed, so that at least preUpdate listeners could use that.

@Gama11
Copy link
Member

Gama11 commented Apr 26, 2016

That seems reasonable.

@MSGhero
Copy link
Member

MSGhero commented May 13, 2016

@Gama11 can you think of any reason these lines can't be moved up to the beginning of the function, after the early exit? https://github.com/HaxeFlixel/flixel/blob/dev/flixel/FlxGame.hx#L725-L736

It's breaking if someone needed to use last frame's elapsed in this frame's preUpdate, but no one has probably ever thought about that before. I don't see coming before switchState being a problem.

@Gama11
Copy link
Member

Gama11 commented May 13, 2016

Why do you need elapsed during switchState() / what's wrong with Joe's suggestion?

@MSGhero
Copy link
Member

MSGhero commented May 13, 2016

If you can't come up with a reason why, then Joe's suggestion is good and I can make a quick PR. I wanted to make sure I wasn't overlooking anything.

@Gama11
Copy link
Member

Gama11 commented May 13, 2016

Go ahead.

@Gama11 Gama11 added this to the 5.0.0 milestone Oct 3, 2016
Aurel300 pushed a commit to larsiusprime/haxeflixel that referenced this issue Apr 18, 2018
@Geokureli Geokureli mentioned this issue Apr 20, 2022
10 tasks
@Geokureli
Copy link
Member

Clearing out 5.0.0 tasks, was this completed? I see preUpdate is called after FlxG.elapsed is set, we don't pass elapsed in draw calls, but do we want to pass it on pre/post update signals? I could go either way, honestly

@Geokureli
Copy link
Member

Geokureli commented Apr 23, 2022

Gonna close this out, for pre/post update they can just use FlxG.elapsed, and draw calls shouldn't use elapsed to begin with. let me know if you have any concerns

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

4 participants