Skip to content

Add feature:wait for next frame#459

Merged
nighca merged 2 commits intogoplus:devfrom
JiepengTan:pr_coroutine_enhance
Nov 29, 2024
Merged

Add feature:wait for next frame#459
nighca merged 2 commits intogoplus:devfrom
JiepengTan:pr_coroutine_enhance

Conversation

@JiepengTan
Copy link
Copy Markdown
Contributor

@JiepengTan JiepengTan commented Nov 28, 2024

Add the feature WaitForNextFrame, which can make the game visuals smoother. #443

The current implementation ensures that all coroutines complete execution for the current frame and enter a waiting state, thereby avoiding bugs where some sprite logic is not executed or only partially executed in a rendering frame.

The code style will have slight changes. Please see the example code below for details.
before:

wait 0.05
changeYpos -10

after:

delta := wait
changeYpos -200 * delta

or

wait
changeYpos -200 * deltaTime

before: 05-Animation.zip

wait_next_old.mp4

after: 05-Animation_new.zip

wait_next_new.mp4

@JiepengTan JiepengTan removed the request for review from xushiwei November 28, 2024 08:58
Comment thread game.go
@JiepengTan JiepengTan requested a review from nighca November 29, 2024 02:25
@nighca nighca merged commit d606748 into goplus:dev Nov 29, 2024
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

Successfully merging this pull request may close these issues.

2 participants