A1Programmer

Is there a Windows and Xbox 360 way that I can get the elapsed time between two events

For instance, I want to find the ammountt of time the user waited between two mouse clicks. It could be 200 ms, or it could be 5620 ms.

I don't need the code for mouse clicks, etc. I just need to know how to get the total elapsed time in milliseconds since the last time I asked for it.

Much like getTickCount in the win32 api.

Thanks!


Re: XNA Framework how to find elapsed time?

dczraptor

You could save the gameTime.TotalGameTime.TotalMilliseconds value at the first click, and then when the user clicks a second time, subtract the total milliseconds current from the saved saved value.

if(firstClick)

baseTime = gameTime.TotalGameTime.TotalMilliseconds;

else if(secondClick)
elapsedTime = gameTime.TotalGameTime.TotalMilliseconds - baseTime;






Re: XNA Framework how to find elapsed time?

A1Programmer

Ah, that's it!

thanks.