My SDL Animation App
Ok I did not like how cone3D does animation. So I wrote my own animation algorithm. It works. Note that this has no timer in it lol. And this image does not move it just floats there and flies lol. A few modifications for instance will make this much more efficient but this was my first SDL app without the use of a tutorial so I figure I would just crack something simple out. Here it is. Oh and of course tell me what you think.
I will include the Cpp in the distro if you want to look at it.
Anim.zip
[Edited by - TheNobleOne on December 3, 2004 8:12:08 AM]
Nice one dude! That's pretty much how I do it.
An extension you could try adding is allowing multiple animations per sprite, and also instead of just incrementing the frame number, you can use an array of indexes so that you can control what order you draw them in, that way you can have more than one animation in the same image file.
Keep it up!
An extension you could try adding is allowing multiple animations per sprite, and also instead of just incrementing the frame number, you can use an array of indexes so that you can control what order you draw them in, that way you can have more than one animation in the same image file.
Keep it up!
Quote:Original post by TheNobleOneHow do you animate without a timer?
Note that this has no timer in it lol.
Quote:Original post by PinguinDude
By using SDL which runs at 60 fps if not lower anyway :P
not true.
Only runs that slow if vsync is turned on.
All I do is basically use SDL_Delay after rendering each frame and then after that increment to the next frame then do it again.
Quote:Original post by TheNobleOneAh. You do realise that that'll cause the animation to play at different speeds on different computers under different operational workloads at different times in different ways?
All I do is basically use SDL_Delay after rendering each frame and then after that increment to the next frame then do it again.
The reason people use timers for this kind of thing is because it ensures the animation won't play back stupidly fast/slow on machines different to the development machine.
[edit: well, if you're using SDL_Delay it shouldn't run faster than normal, but if your framerate drops it'll run slower.]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement