Jump to content
  • Advertisement
Sign in to follow this  
Tazadar

Rotations with sprite [C++]

This topic is 3710 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

Hello i got a problem when i want to rotate a sprite i dont know how i can change its rotation-center Any idea? Thanks

Share this post


Link to post
Share on other sites
Advertisement
What do you mean a "sprite"? ID3DXSprite? A textured quad? Some other library version of a sprite?

Assuming ID3DXSprite, the Draw() function takes vector for the center of the sprite, and ID3DXSprite::SetTransform() can be used to set a rotational transform (Although I'm not entirely sure of the details, it's been years since I used ID3DXSprite).

Share this post


Link to post
Share on other sites
here is my code

void CSprite::Draw(LPD3DXSPRITE d3dspt)
{
d3dspt->Begin(D3DXSPRITE_ALPHABLEND); // // begin sprite drawing with transparency

// draw the sprite

d3dspt->Draw(sprite, NULL, ¢er, &position, D3DCOLOR_ARGB(255, 255, 255, 255));

d3dspt->End(); // end sprite drawing

}

if i add a rotation matrix with SetTransform() the center is not the center of my texture (i am using LPDIRECT3DTEXTURE9 ) but a point which is at the top of the screen :(

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!