• Advertisement

Archived

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

Blt Help

This topic is 5954 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 am trying to use color keying with my game, and my current bitmap function uses bit blt and i need to use Blt. But i cant get it to work at all,here is what i have so far. int DisplayBitmap(LPDIRECTDRAWSURFACE lpdds,int x1,int y1,int x,int y,LPSTR szImage) { HBITMAP hbm; BOOL bReturn=FALSE; DDSURFACEDESC ddsd; RECT gh; gh.top=x1; gh.bottom=y1; gh.left=x; gh.right=y; ZeroMemory(&ddsd,sizeof(ddsd)); ddsd.dwSize=sizeof(ddsd); ddsd.dwFlags=DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; ddsd.dwWidth =800; ddsd.dwHeight=600; ddsd.ddsCaps.dwCaps=DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY; lpdd->CreateSurface(&ddsd,&lpddsbitmaps,NULL); lpddsbitmaps=DDLoadBitmap(lpdd,szImage,0,0); lpdds->Blt(&gh,lpddsbitmaps,NULL,DDBLT_WAIT | DDBLT_KEYSRC,NULL); }

Share this post


Link to post
Share on other sites
Advertisement

//Displays a bitmap at any given coordinates
int DisplayBitmap(LPDIRECTDRAWSURFACE lpdds,int x1,int y1,int x,int y,LPSTR szImage)
{

HBITMAP hbm;
BOOL bReturn=FALSE;
DDSURFACEDESC ddsd;
RECT dh;
RECT gh;
SetRect(&gh,x,x1,y,y1);
SetRect(&dh,0,100,0,100);
ZeroMemory(&ddsd,sizeof(ddsd));

lpddsbitmaps=DDLoadBitmap(lpdd,szImage,0,0);

color.dwColorSpaceLowValue = 0;
color.dwColorSpaceHighValue = 0;

lpddsbitmaps->SetColorKey( DDCKEY_SRCBLT, &color);
lpdds->BltFast(x1,y1,lpddsbitmaps,NULL,DDBLTFAST_WAIT | DDBLTFAST_SRCCOLORKEY);

bReturn=TRUE;


return bReturn;
}

Share this post


Link to post
Share on other sites
int DisplayBitmap(LPDIRECTDRAWSURFACE lpdds,int x1,int y1,int x,int y,LPSTR szImage)
{

HBITMAP hbm;
BOOL bReturn=FALSE;
DDSURFACEDESC ddsd;
RECT dh;
RECT gh;
SetRect(&gh,x1,x1+x,y1,y1+y);
SetRect(&dh,0,100,0,100);
ZeroMemory(&ddsd,sizeof(ddsd));
ddsd.dwSize=sizeof(ddsd);

lpddsbitmaps=DDLoadBitmap(lpdd,szImage,0,0);

color.dwColorSpaceLowValue = 0;
color.dwColorSpaceHighValue = 0;

lpddsbitmaps->SetColorKey( DDCKEY_SRCBLT, &color);
lpdds->Blt(&gh,lpddsbitmaps,NULL,DDBLT_WAIT | DDBLT_KEYSRC,NULL);
bReturn=TRUE;


return bReturn;
}

Share this post


Link to post
Share on other sites

  • Advertisement