Firefox与我的计时器以某种方式交互?这是疯了^^ [英] Firefox interacts with my timers somehow ?!?! This is crazy ^^

查看:214
本文介绍了Firefox与我的计时器以某种方式交互?这是疯了^^的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的win32 C ++ DirectX游戏中的计时器有一个问题(一个小演示)。我使用timeGetTime获取当前时间,并使用它来播放动画或逻辑通过使用增量时间(我也使用常量进行标准化时的动画)。有时,我使用低至2毫秒的tickrate。我在使用时只使用ULONGs。游戏工作正常,但如果我启动Mozilla Firefox,我开始游戏毕竟是非常快的(动画和游戏逻辑)。这就像快速转发。奇怪的是,似乎几个计时器不受此影响。有人有线索吗? Firefox和我的计时器之间的连接是什么?退出Firefox后保持不变,但在一些未定义的时间或PC重新启动后,它会恢复正常。任何建议是赞赏,即使它是一个长镜头。谢谢。

I have a problem with the timers in my win32 C++ DirectX game (a little demo). I am using "timeGetTime" to get the current time and use it to playback the animations or for logic by using the delta time (I also use a constant for normalization when animating). I use a tickrate as low as 2 miliseconds sometimes. I am using only ULONGs when working with time. The game works just fine, but if I start Mozilla Firefox and I start the game after all is playing very fast (the animations and the game logic). It's like fast forwarding. The strange thing is that it seems that a few timers are not affected by this. Does someone have a clue ? What is the connection between Firefox and my timers ? After exiting Firefox is stays the same, but after some undefined time or a PC restart it goes back to normal. Any suggestions are appreciated, even if it is a long shot. Thank you.

推荐答案

是的,TimeGetTIme的默认精度为5ms或更高。

Yes the default precision of TimeGetTIme is 5ms or more.

这可以通过调用timeBeginPeriod和timeEndPeriod函数来改变。
交替TimeGetTime的精度影响所有正在运行的应用程序。
我猜Firefox正在调用那些影响你的应用程序的函数。

This can be altered with the calls timeBeginPeriod and timeEndPeriod functions. Alterning the precision of TimeGetTime affects all running applications. I guess Firefox is calling those functions which affect your application.

更改为使用QueryPerformanceCounter / QueryPerformanceFrequency方法,而不是提供高res时间,对于TimeGetTime的问题。

Change to use the QueryPerformanceCounter/QueryPerformanceFrequency methods instead which provide high res timing and will not be subject to the issues of TimeGetTime.

编辑:
几个链接,显示如何使用这些功能。

A couple of links that show you how to use the functions.

http://www.programmersheaven.com/mb / windows / 311148/311148 / using-queryperformancecounter /

还要注意MSDN页面上的注释:
http://msdn.microsoft.com/en-us/library/ms644904 v = vs.85).aspx

And also note the remarks on the MSDN page: http://msdn.microsoft.com/en-us/library/ms644904(v=vs.85).aspx

这篇关于Firefox与我的计时器以某种方式交互?这是疯了^^的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆