DirectDraw Beginner: Help with smooth animations needed

Started by
0 comments, last by andy 24 years, 6 months ago
Hi,
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?

Cheers
Andy

Advertisement
Hi.

I think the best way looks like this:

code:
#include mmsystem.hDWORD LastTime;while (sth)  // This is your loop{LastTime = timeGetTime ();// Your codewhile ((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).]

This topic is closed to new replies.

Advertisement