Archived

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

ACAC

ID3DXSprite Problem!!

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 this post


Link to post
Share on other sites