Archived

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

question on bltting

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

i have 2 questions here first question: my problem is i have this function that takes in a surface and parameters to blt from and to a surface my problem is that i cant get it to work properly. i have it set up so that the source x and y are cell cordinates like 0,0 is bitmap 1 in the top left corner and 1,0 would be the next each bitmap is seperated by a one pixel buffer but when i try the cordinates 1,0 it starts on the one pixel buffer and not the one after and i cant figure out how to correct this
    

int bltsurface(LPDIRECTDRAWSURFACE7 lpddstemp,int sx,int sy,int dx, int dy)
{
	RECT src_rect,dst_rect;
	DDSURFACEDESC2 ddsd; 
	src_rect.top	=	(sy*ddsd.dwHeight);
	src_rect.left	=	(sx*ddsd.dwWidth);
	src_rect.right	=	(sx*64)+63;
	src_rect.bottom	=	(sy*64)+63;


	dst_rect.top	=	dy;
	dst_rect.left	=	dx;
	dst_rect.right	=	dx+63;
	dst_rect.bottom	=	dy+63;

	//cx = cx*(ddsd.dwWidth+1) + 1;
	//cy = cy*(ddsd.dwHeight+1) + 1;


lpddsback->Lock(NULL,&ddsd,DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR,
            NULL);
if (FAILED(lpddsback->Blt(&dst_rect,lpddstemp,&src_rect, DDBLT_WAIT,NULL)))
return 0;
lpddsback->Unlock(NULL);


return 1;
}

[/source]

question 2

in my function here that reads in an array and draws bitmaps according to the array i cant get it to read in the array right how do i do this

[source]

int drawmap(void *parms)
{
int ar[4][4]=
{
    0,0,0,0,
    0,0,0,0,
    0,0,0,0,
    0,0,0,0
};

for (x=0;x<4x++)
{
    for (y=0;y<4;y++)
    {
     if (ar[x][y]=1)
        drawbitmap 1;
    }
} 
	

return 1;
}
    

Share this post


Link to post
Share on other sites