Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


DirectDraw Animation

This topic is 6032 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi... I''m trying to set up some simple animation with DirectDraw. I''ve tried frame-based (which, I think, sux) and with High-Peformance counter (QueryPerformanceCounter, Frequency)... My demo with high-perfomance is just blinking (the code is taking too much time to go through I think). You guys have any suggestions of the way I should use to do my timing? Or any demo that I can see? Last of The Returners

Share this post

Link to post
Share on other sites
I have always used GetTickCount() in my games, it is only accurate to within 10 ms but that has been accurate enough for everything I have done. Here is a brief example copied almost directly from a 2D asteroids game I did a few years ago.

int currentTime, previousTime = GetTickCount();
while(true) //main game loop
currentTime = GetTickCount();
float elapsedTime = (currentTime - previousTime)/1000.0f; //elapsed time in seconds

//update coordinates of ship based on time elapsed
//and ship''s velocity (in pixels per second)
ship.x += (ship.xVel * elapsedTime);
ship.y += (ship.yVel * elapsedTime);

previousTime = currentTime;

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!