• Advertisement


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

DirectDraw Beginner: Help with smooth animations needed

This topic is 6757 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

I've just started learning DirectX, starting with DirectDraw.

I've got a ball bouncing round the screen.
If I set the screen res to 640x480 it's pretty smooth, but if I set it to 800x600 then it's very jerky. Then I tried 1024x768, the ball is now moving very smoothly?

Can anyone help me? I want it to be smooth for all screen res settings.

I don't do any timing, is this the problem? If so, is there some sample code?


Share this post

Link to post
Share on other sites

I think the best way looks like this:


#include mmsystem.h

DWORD LastTime;

while (sth) // This is your loop
LastTime = timeGetTime ();

// Your code

while ((timeGetTime () - LastTime) < WAIT_TIME)
// You can put in sth useful here
// (like Wave-Streaming)

This code avoids the program to run too fast on better computers.
If you want your ball to move at a constant speed (independant to the framerate) it would be much more difficult

Well, that's the way I'm doing it and it works fine with my text-scroller...

[This message has been edited by Melo (edited October 22, 1999).]

Share this post

Link to post
Share on other sites

  • Advertisement