Jump to content
  • Advertisement
Sign in to follow this  
Uphoreum

D3DXSPRITE Rotation

This topic is 3997 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!