PDA

View Full Version : animations moving too fast in microsoft .net C++



Stephanie
03-31-2004, 05:43 PM
I'm wondering if there isn't a setting somewhere in visual .net that will effect the speeds of animations. I run one program at school and the speed seems perfectly fine, and i run the same program at home and it moves so fast that it's distorted. Any ideas?

Thanks,
Stephanie

MickeyMouse
04-01-2004, 12:29 AM
Hi!!
Seems like your program is CPU/GPU speed dependent:)
Any program that wants to be run at the same speed on every computer should make use of time variable.

4TheKing
04-02-2004, 09:21 PM
Yep. I agree. Have any code to show us?

Stephanie
04-03-2004, 09:41 AM
Thanks, this isn't my code but it's code from a class I'm taking, and it's awfully long. What it is is a car that goes around and around a race track, so I'm guessing I'd have to put the time variable in the idle function.

how exactly does the time variable work?

dlswimmer
04-07-2004, 08:11 AM
you can idle it, but that is very inefficient for fast computers. One way to fix it is to change the amout the animation moves each rendering. you can use timeGetTime() to get current time, then use a ratio (like 40/fps if your target fps is 40) then multiply it by what you are adding to the distance change. This allows the animations to be lots smoother on faster computers, while keeping the speed the same on slower ones.

dlswimmer
04-07-2004, 08:13 AM
oh, to get the fps, you take the current timeGetTime and subtract it from the last one to get how many milliseconds have passed. Then you take that number, say milli, and divide it into 1000 (1000/milli) to get the fps (make sure it is a float) Then you can use that as a ratio multiplier in your animation.

Sord
04-07-2004, 06:03 PM
Try enabling vsync. If you have an ATI card it is in display properties->settings->advanced->3d->opengl