[cpp] 关于固定刷新率
吴俊玉
wujunyu at gmail.com
Sun Apr 2 22:40:15 CST 2006
看了云风的感悟中关于固定刷新率的实现
书没带来学校,凭记忆实现方式如下:
GetSystemTime(&begin);
while(1)
{
if(PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
{
if(!GetMessage(&msg, NULL, 0, 0 )) return msg.wParam;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else //判断时间间隔是不是需要刷新,如何获取系统时间?
{
GetSystemTime(&now);
if ((t=Application::timeRange(&begin,&now)) > requiredTime)
{//比较两时间的差别,以ms表示。
requiredTime+=blank;
}
}
}
感觉使用GetSystemTime好像比较低效,
当然也可能与我的求差的函数有关 8213; 8213;
BTW是不是有便捷的方法计算两个Time时间的差?
我使用这种方式显示图片很不流畅,会有停顿感,看了Charles
Petzold关于一个蹦蹦球的例子,很受启发,他使用的是Timer,并把实际图像的的外围用空白包围,对我来说很新颖的想法。图像非常流畅。
我可不可以使用Timer控制刷新率,不知道大家都是怎么用的
或者有什么先进的方法,诚心求教
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://codingnow.com/pipermail/cpp/attachments/20060402/0ee718fd/attachment.html
More information about the Cpp
mailing list