Jump to content
  • Advertisement

Archived

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

hammerstein_02

Strange RECT problem..

This topic is 5727 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

Ok, that sounds like an illness, but my post isn''t about that. The doctors told me I am gonna be ok.. Anyways, I am trying to blit part of a surface to another surface using DirectDraw7, and I am using the following code:
  
if(FAILED(m_lpDrawSurface->Blt(&dstRect, m_lpMainSurface, &srcRect, DDBLT_WAIT, NULL)))
{
sprintf(buffer, "(%i,%i,%i)\n Source: %i, %i, %i, %i\n",
        m_iFrameCounter, m_iFramesWide, m_iHeight,
	srcRect.left, srcRect.top,srcRect.right,srcRect.bottom);
		
logFile << buffer;

return(NULL);
}
  
my dstRect is defined as 0,0,64,64 (which is the size of my drawto surface). My srcRect is obviously updated every frame. Done so by this method.
  
		int		xOff = (m_iFrameCounter % m_iFramesWide);  // Decide the x offset!

		int		yOff = (m_iFrameCounter / m_iFramesWide);
		
		srcRect.left = xOff * m_iWidth;
		srcRect.top = yOff * m_iHeight;
		srcRect.right = srcRect.left + m_iWidth;
		srcRect.bottom = srcRect.top + m_iHeight; //Set where we want to blit from.. 

  
Now, with that code, this is the resultant log file (3,3,64) Source: 0, 64, 64, 128 (3,3,64) Source: 0, 64, 64, 128 (3,3,64) Source: 0, 64, 64, 128 (3,3,64) Source: 0, 64, 64, 128 (3,3,64) Source: 0, 64, 64, 128 If I move the sprintf information to just before that call, here is the output in my logfile. (0,3,64) Source: 0, 0, 64, 64 (1,3,64) Source: 64, 0, 128, 64 (2,3,64) Source: 128, 0, 192, 64 (3,3,64) Source: 0, 64, 64, 128 (3,3,64) Source: 0, 64, 64, 128 Basically that is the code that is going wrong.. my image is 192*64.. please help me.. this is doing my head in! Thanks for your time =*= If things seem bad, think that they can get a whole load worse, and they don''t seem so bad anymore =*=

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!