What's the best way to implement a render loop? #1087
Unanswered
drewcrawford
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm wondering about the best practice for implementing a render loop. This is for real-time drawing, there's a function that draws a frame at a fast speed and I need to figure out how to call it in a loop while responding to UI events.
I found a discussion of the problem here for UWP, which is I guess a historical approach. That guide has various solutions of the form
Dispatcher.ProcessEvents(...)
.However, the WinUI documentation says this was deprecated. The new API DispatcherQueue does not seem to have an analogous function.
I also turned up this spec which seems to outline a solution based on
GetMessageW
andDispatchMessageW
. I implemented that here but it seems incorrect. The cursor locks over the window and it can only be resized intermittently.Would appreciate any pointers to how to fix this or better patterns to use.
Beta Was this translation helpful? Give feedback.
All reactions