SDL digest, Vol 1 #392 - 35 msgs

Hi,

I’m a total beginner using SDL and having a working knowledge of C/C++.

I downloaded a tutorial on SDL that basically displays and allows u to move
the bitmap with the arrow keys.

My problem is that the bitmap is moving too slowly. I want it to move very
quick like say a missile would or something. However if i increase the x
coordinate of the bitmap more than 1 pixel a frame then it becomes jerky.

I have been trying to use some sort of timing in my program but it still
doesn’t work the way i want it to.

The original program can be found at http://cone3d.gamedev.net . Lesson 2 is
what i am experimenting with.

In my timing routine i have at this time…

float DeltaTime = 0.0; double LastTime = 0.0; int FPSCounter = 0; float
FPSRate = 0;
//check for key presses etc here
FPSCounter++;
if (timeGetTime()>LastTime+1000)
{
FPSRate=FPSCounter;
FPSCounter=0;
DeltaTime = 1/FPSRate;
xpos += (DeltaTime*100);
LastTime = timeGetTime();
DrawScene();
}

This moves the bitmap to the right on the screen about 50-100 pixels
instantly and then it stops and doesn’t move again. My goal is to have a
very fast moving bitmap, moving smoothly. At the moment to get it smooth it
is very slow, and to get it fast, it is very jerky.

If anyone can tell me what i am doing wrong, i would be very grateful! :slight_smile:

Thanks for your time

Werdy666
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: image/gif
Size: 494 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20020529/dc05eebc/attachment.gif