Jump to content
  • Advertisement
Sign in to follow this  
kingpinzs

directdraw clipper help

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

Is this how you make a fullscreen cliper. because all I get is a black screen now g_pdd->CreateClipper(0,&g_pddclipper,NULL); g_pddclipper->SetHWnd(0,hwnd); lpBackBuffer->SetClipper(g_pddclipper);

Share this post


Link to post
Share on other sites
Advertisement
Which blt-method do you use? If you're using BltFast it will fail because it doesn't support clippers hence the black screen.

BltFast returns DDERR_UNSUPPORTED if it fails because of the clipper.

I would suggest you try using the Blt method instead.

\Jimmy H

edit: Yes, your clipper creating is correct, if you intend to use it with for example the IDIRECTDRAWSURFACE7::Blt method.

Share this post


Link to post
Share on other sites
If you do something like this with BltFast now:


RECT srcRect;

srcRect.left = 0;
srcRect.top = 0;
srcRect.right = 20;
srcRect.bottom = 20;

lpDirectDrawSurface7->BltFast(x, y, lpDirectDrawSurface7Sprite, &srcRect, 0);





You could do this with Blt instead:


RECT srcRect;

srcRect.left = 0;
srcRect.top = 0;
srcRect.right = 20;
srcRect.bottom = 20;

RECT dstRect;

dstRect.left = x;
dstRect.top = y;
dstRect.right = x + srcRect.right;
dstRect.bottom = y + srcRect.bottom;

lpDirectDrawSurface7->Blt(&dstRect, lpDirectDrawSurface7Sprite, &srcRect, 0, NULL);





Remember if you want to avoid hardware scaling + antialias keep the same source RECT dimensions in the destination RECT.

\Jimmy H

edit: Blt & BltFast takes the addresses to the RECTs

[Edited by - Jimmy H on November 28, 2004 2:00:34 PM]

Share this post


Link to post
Share on other sites
363 H:\My projects\directx\main.cpp no matching function for call to `IDirectDrawSurface7::Blt (RECT&, IDirectDrawSurface7*&, RECT&, int, NULL)'

error C:\Dev-Cpp\include\ddraw.h:1993 candidates are: virtual long int IDirectDrawSurface7::Blt(tagRECT*, IDirectDrawSurface7*, tagRECT*, long
what does this mean?

Share this post


Link to post
Share on other sites
I forgot Blt and BltFast wants the adresses to the RECTs so it should look like this (sorry for the confusion):

lpDirectDrawSurface7->Blt(&dstRect, lpDirectDrawSurface7Sprite, &srcRect, 0, NULL);

Share this post


Link to post
Share on other sites
What kind of transparency are you after? Try searching the docs for 'colorkey' as I think that's all you can really do with DirectDraw.

Share this post


Link to post
Share on other sites
Did you get the Blt to work?

You could make a surface use for example a source-colorkey (the color specified by the surface's colorkey will not be drawn when the surface is drawn onto another surface).

The colorkey could either be set using the IDIRECTDRAWSURFACE7::SetColorKey function or maybe easier when the surface is created:


//create DirectDraw surface

DDSURFACEDESC ddsd; //surface description
LPDIRECTDRAWSURFACE lpDDFace = NULL;

ZeroMemory(&ddsd, sizeof(ddsd)); //set all data in ddsd to 0

ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_CKSRCBLT; //DDSD_CKSRCBLT - ColorKeySourceBlt enabled
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
ddsd.dwWidth = width;
ddsd.dwHeight = height;

//set the source-colorkey range

ddsd.ddckCKSrcBlt.dwColorSpaceLowValue = 0;
ddsd.ddckCKSrcBlt.dwColorSpaceHighValue = 10;

//(all the colors between 0 and 10 will not be drawn from this surface)

g_lpDirectDraw->CreateSurface(&ddsd, &lpDDFace, NULL)



Then when the surface is to be drawn specify that the source colorkey should be used with the DDBLT_KEYSRC flag:

g_lpDDFaceBack->Blt(&rDst, g_lpDDFace, &rSrc, DDBLT_KEYSRC, NULL);



\Jimmy H

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!