Sign in to follow this  

Rotations with sprite [C++]

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

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

This topic is 3492 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.

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