-
Notifications
You must be signed in to change notification settings - Fork 5
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
fix: 控帧方式从sleep+死循环修改为带误差修正的sleep #8
Conversation
顺便解除了对windows的依赖
参考这篇博客:https://blat-blatnik.github.io/computerBear/making-accurate-sleep-function/ RGM当前的方式是precise sleep,之前讨论的WaitableTimer方案是timer sleep,pr的方案是system sleep。如博客展示的数据,system sleep精度差太多了(即使用的是high_resolution_clock + nanoseconds),pr里通过error 补偿,但因为精度较低导致每帧时间的浮动是±1ms,我觉得不合适。改成timer sleep + error调整如何,这个精度可以控制在0.1ms内。 关于代码本身:
|
读了博客很有感触。后续我会对 用 long double 存 error_counter 的原因: |
已修改实现,见 issue #7 |
功能实现没有问题。有几处代码风格你看一下要不要改,不改的话也没关系,过两天我就会合并。
|
此处为手误,已修改。
设计如此。此宏定义是预留的,以防 POSIX 标准下也有类似
已修改。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
非常好工作,爱来自红宝石游戏现代。
issue #7