Jump to content
  • Advertisement

Archived

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

ACAC

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.

If you intended to correct an error in the post then please contact us.

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
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!