Hello Anees,
First off, when posting it’s a good idea to use “code tags”, which are located above the area where you type or paste your message/code; this improves the readability of your code. I don’t know which operating system you’re using, but any operating system has a way of “doing things” in the background, resulting in inevitable jerks if you have “frame rate-independent” movement.
bala_48225 wrote:
Hello Anees,
First off, when posting it’s a good idea to use “code tags”, which are located above the area where you type or paste your message/code; this improves the readability of your code. I don’t know which operating system you’re using, but any operating system has a way of “doing things” in the background, resulting in inevitable jerks if you have “frame rate-independent” movement.
I am using Windows XP SP3.
Me too. The best tutorial I’ve read about framerate independent movement was here:
Idk whether your code is as good or better than that one.
As for actual performance, I’ve been able to increase the speed of my animations by only writing over only the part of the screen that the image used to be at two frames ago, and then putting my images onscreen at their new spots, rather than using SDL_FillRect for the whole screen, or blitting the whole background onto the screen. So, you would be blitting the background over only a certain part of the screen, or using SDL_Fillrect on only a part of the screen rather than doing the whole screen each frame. That has resulted in really fast animation and unparalleled smoothness, at least for my game which only has 2 characters onscreen at a time. When you get 20 characters, etc., with a nice multicolored, blended and shaded background, then it’s time to get into OpenGL texture animation; that’s definitely the impression I’ve been given by those “in the know”. -B
so, how goes it? any luck with the animation jerks?