I need help with some coordinates things
Code:
//set up rectangle for filling
RECT rcFill;
SetRect(&rcFill,ptLastPosition[0].x,ptLastPosition[0].y,ptLastPosition[0].x+gdicBall.GetWidth(),ptLastPosition[0].y+gdicBall.GetHeight());
//set up a ddbltfx
DDBLTFX ddbltfx;
memset(&ddbltfx,0,sizeof(DDBLTFX));
ddbltfx.dwSize=sizeof(DDBLTFX);
//set up a color fill of black
ddbltfx.dwFillColor=0;
//blt the color fill to the back buffer
lpddsBack->Blt(&rcFill,NULL,NULL,DDBLT_WAIT | DDBLT_COLORFILL, &ddbltfx);
//set up source and destination rects for blitting the ball
RECT rcSrc;
RECT rcDst;
SetRect(&rcSrc,0,0,gdicBall.GetWidth(),gdicBall.GetHeight());
CopyRect(&rcDst,&rcSrc);
OffsetRect(&rcDst,ptBallPosition.x,ptBallPosition.y);
/* ptBallPosition.x=0;//remember that this initialized the
ptBallPosition.y=0; //position of the ball and all that.
ptLastPosition[0].x=0;
ptLastPosition[0].y=0;
ptLastPosition[1].x=0;
ptLastPosition[1].y=0;
ptBallVelocity.x=16;
ptBallVelocity.y=8;*/
//blit the ball
lpddsBack->Blt(&rcDst,lpddsBall,&rcSrc,DDBLT_WAIT, NULL);//don't really need a source
//copy current position of ball to old position
ptLastPosition[0]=ptLastPosition[1];
ptLastPosition[1]=ptBallPosition;
//move the ball
ptBallPosition.x+=ptBallVelocity.x;
ptBallPosition.y+=ptBallVelocity.y;
//bounds checking
//left side
if(ptBallPosition.x<=0) ptBallVelocity.x=abs(ptBallVelocity.x);
//top side
if(ptBallPosition.y<=0) ptBallVelocity.y=abs(ptBallVelocity.y);
//right side
if(ptBallPosition.x>=(int)dwDisplayWidth-gdicBall.GetWidth()) ptBallVelocity.x=-abs(ptBallVelocity.x);
//bottom side
if(ptBallPosition.y>=(int)dwDisplayHeight-gdicBall.GetHeight()) ptBallVelocity.y=-abs(ptBallVelocity.y);
//flip surfaces
lpddsPrime->Flip(NULL,DDFLIP_WAIT);
I don't really understand that part that is in bold.