Sign in to follow this  

D3DXSPRITE Rotation

This topic is 3841 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to figure out how to do rotation with a D3DXSPRITE. In XNA, you can pass an angle to the SpriteBatch (which I assume to be the XNA equivalent of D3DXSPRITE) to change the drawing angle. There is no argument like that in the D3DXSPRITE Draw method. I noticed that it has a SetTransform method that takes a matrix as an argument. I would assume I could use that to set things like, rotation and scaling. I'm pretty new to using DirectX, so I don't know how I create a matrix that I can pass into that function. Could someone give me an example?

Share this post


Link to post
Share on other sites
You need to use:
D3DXMatrixAffineTransformation2D(&mat,SCALE,HOT_SPOT,ANGLE,POSITION);
lpSprite->SetTransform(&mat);
lpSprite->Draw(TEXTURE,NULL,NULL,NULL,COLOR);

Share this post


Link to post
Share on other sites
Thanks!

It looks like I can either give position information via the matrix or the Draw method of D3DXSPRITE. Does it make a difference which way I do it?

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
Google knows all [smile]


Few months ago, my boss took a pride in founding a great web page with lot of useful links. It was google.com...[totally]

Share this post


Link to post
Share on other sites
Sign in to follow this