I have read that I need to define a transformation matrix for the sprite in order to do it. Similar to:
m_sprite->Begin(D3DXSPRITE_ALPHABLEND);// Texture being used is 64 by 64:D3DXVECTOR2 spriteCentre=D3DXVECTOR2(32.0f,32.0f);// Screen position of the spriteD3DXVECTOR2 trans=D3DXVECTOR2(50.0f,80.0f);// Rotate based on the time passedfloat rotation=timeGetTime()/500.0f;// Build our matrix to rotate, scale and position our spriteD3DXMATRIX mat;D3DXVECTOR2 scaling(2.0f,2.0f);// out, scaling centre, scaling rotation, scaling, rotation centre, rotation, translationD3DXMatrixTransformation2D(&mat,NULL,0.0,&scaling,&spriteCentre,rotation,&trans);// Tell the sprite about the matrixm_sprite->SetTransform(&mat);// Draw the sprite m_sprite->Draw(m_texture,NULL,NULL,NULL,0xFFFFFFFF));// Thats itm_sprite->End();
However, I only want this particular sprite to be rotated, not all of them. So my question is, will this effect the other sprites as well, or should I create another instance of the LPD3DXSPRITE to handle the ones with the transformation matrix? Or should I use the same one and just reset the transformation matrix after I draw the sprites that need to be rotated, if so how? Or should I just use this transformation matrix like this and adjust the others accordingly.
I plan on having approximately 20 sprites that need to be rotated this way, but I don't want the sprites I use to compose my background to be affected or my sprite for my control to be affected. What would you guys recommend?