ID3DXSprite Problem!!

Started by
0 comments, last by ACAC 21 years, 6 months ago
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,&centerVector,
					(0.0174 * m_Angle),
					&translationVector,D3DCOLOR_RGBA(255,255,255,this->m_Alpha));
}  
Advertisement
Perhaps a look at the article "Dissecting Sprites in Direct3D" will help (to be found in the DirectGraphics section right here ;-)).
Im Anfang war die Tat...Faust

This topic is closed to new replies.

Advertisement