Sign in to follow this  
Makoy

Sprite animation, blitting etc.

Recommended Posts

Assuming you're using D3DXSprite, what you want to do is change the values passed by pSrcRect (the second parameter) when you call the Draw method. It specifies which area of the texture (the first parameter) to display.

Just put all your 'frames' for the animation in one texture, and then change frames by changing areas.

There's a tutorial out there somewhere. I'll see if I can find it if you're interested.

Share this post


Link to post
Share on other sites
Quote:
Assuming you're using D3DXSprite, what you want to do is change the values passed by pSrcRect (the second parameter) when you call the Draw method. It specifies which area of the texture (the first parameter) to display.

Just put all your 'frames' for the animation in one texture, and then change frames by changing areas.

There's a tutorial out there somewhere. I'll see if I can find it if you're interested.


yes I'm very much interested. Could you please let me check the link? I'm not yet familiar with the "pSrcRect" thing.

Edit: Fixed quote tag

[Edited by - Coder on November 15, 2004 2:38:37 AM]

Share this post


Link to post
Share on other sites
Keith Ditchburn has a good site, I've referred people to this site quite often. Here is a link for you on sprites :

http://www.toymaker.info/Games/html/sprites.html

Hope this helps you.

Steve

Share this post


Link to post
Share on other sites
yeah but some of the codes in codesampler doesn't compile on my vc++ :(

here's the error I got when I compiled the dx9_d3dxsprite:
dx9_d3dxsprite.cpp
c:\downloads\game\dx9_d3dxsprite\dx9_d3dxsprite\dx9_d3dxsprite.cpp(359) : error C2065: 'D3DXSPRITE_ALPHABLEND' : undeclared identifier
c:\downloads\game\dx9_d3dxsprite\dx9_d3dxsprite\dx9_d3dxsprite.cpp(365) : error C2660: 'Draw' : function does not take 5 parameters
Error executing cl.exe.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this