Skip to main content
gamedev.net
🔒 Locked

Animation Help

Started by SteveHawco2005 Jan 3, 2005 at 7:44 PM 0 replies 300+ views
Original Post
SteveHawco2005
SteveHawco2005
I'm just wondering if any of you could direct me to some info/tutorials on coding 2D animation using DirectX
roos
roos
If your game is ENTIRELY 2D, then I would recommend using D3DXSprite, it makes things very easy

If your game is 3D, but you want to be able to have 2D animations, say for GUI elements, then you're gonna have to do something a bit more complicated... Store multiple frames of the animation together in 1 texture, have a system for determining which texture coordinates correspond to which frame, then create quads (2 triangles) and render them to the screen while applying the texture...

Here is some code you can use if you want as a reference... I wrote it maybe 2-3 years ago, it's based on DirectX 8 and uses D3DXSprite...

http://www.ews.uiuc.edu/~rsharma/source/DirectGraphics.zip

EDIT: btw I forgot to mention... This is prolly obvious, but to actually create an animation, simply draw the different images one after another in order... You should have some system to specify how many milliseconds or so each frame is rendered, and then use a timer to help keep track of which frame should be displayed... If you need some timer code, google for "QueryPerformanceCounter"

Good luck,
roos

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.