#### Archived

This topic is now archived and is closed to further replies.

# ID3DXSprite Problem!!

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

## Recommended Posts

Hey all, Ive recently started writing a simple libary for the use in my games. I decided to use ID3DXSprite because it simplifies things a little. But im now having problems with the second parameter, inwhich you specify a source rectangle to blit from. If i specify the size of my texture, the part which is drawn is always smaller than what i specify. I cant work out why... Its not the parameters ive got wrong because ive checked the values by using the debugger. Ive also noted that im using a 32bit texture, and a 32bit screen display. So the loss of texture information isnt lost there.. Im stuck for any other ideas as to why this may be happening. Any help would be greatly appreciated. Thanks, Heres a snippet of the code I use.
  void CSprite::Draw()
{
RECT srcRect;
srcRect.bottom = m_CellHeight * this->m_CurFrameY + m_CellHeight;
srcRect.top    = m_CellHeight * this->m_CurFrameY;
srcRect.right  = m_CellWidth  * this->m_CurFrameX + m_CellWidth;
srcRect.left   = m_CellWidth  * this->m_CurFrameX;

D3DXVECTOR2 translationVector;
translationVector.x = m_X;
translationVector.y = m_Y;

D3DXVECTOR2 centerVector;
centerVector.x = m_X+m_CellWidth/2;
centerVector.y = m_Y+m_CellHeight/2;

m_pSprite->Draw(m_pSpriteTexture->m_Texture,
&srcRect,
NULL,¢erVector,
(0.0174 * m_Angle),
&translationVector,D3DCOLOR_RGBA(255,255,255,this->m_Alpha));
}  

##### Share on other sites
Perhaps a look at the article "Dissecting Sprites in Direct3D" will help (to be found in the DirectGraphics section right here ;-)).

1. 1
2. 2
Rutin
21
3. 3
JoeJ
18
4. 4
5. 5

• 14
• 39
• 23
• 13
• 13
• ### Forum Statistics

• Total Topics
631717
• Total Posts
3001878
×