#### Archived

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

# Strange RECT problem..

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

## 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 =*=

• 17
• 11
• 11
• 9
• 49
• ### Forum Statistics

• Total Topics
631394
• Total Posts
2999750
×