DirectDraw7 SemiTransparency?

I have started making a game in DirectX7 and VB.Net 2005 Express, and I was wondering how to make a surface display to the screen as being a certain amount of translucency. The code I used to make the surface is:

Sub LoadCDSurface()

Dim ddsd As DDSURFACEDESC2

ddsd.lFlags = CONST_DDSURFACEDESCFLAGS.DDSD_CAPS Or CONST_DDSURFACEDESCFLAGS.DDSD_HEIGHT Or CONST_DDSURFACEDESCFLAGS.DDSD_WIDTH

ddsd.ddsCaps.lCaps = CONST_DDSURFACECAPSFLAGS.DDSCAPS_OFFSCREENPLAIN

ddsd.lHeight = 32

ddsd.lWidth = 32

CDSurface = dd.CreateSurfaceFromFile(dataLocation & "disk.bmp", ddsd)

Dim key As DDCOLORKEY

key.high = RGB(0, 0, 0)

key.low = RGB(0, 0, 0)

CDSurface.SetColorKey(CONST_DDCKEYFLAGS.DDCKEY_SRCBLT, key)

End Sub

The code I used to blt the surface to the screen is:

ddsB.BltFast(0, 568, CDSurface, CreateRect(0, 0, 32, 32), CONST_DDBLTFASTFLAGS.DDBLTFAST_WAIT Or CONST_DDBLTFASTFLAGS.DDBLTFAST_SRCCOLORKEY)

What changes do I need to make to make it display as 50% transparent over the background




Answer this question

DirectDraw7 SemiTransparency?

  • polien

    OK Thanks


  • PKell

    Sorry I hadn't realized there was a DirectX forum -

    In answer to why I am using DirectX 7 - In DirectX9.0 DirectDraw has been combined with Direct3D, thus making it harder for a novice like me to use!

    Anyway, I'll repost this on the Direct X forums.


  • Shawn.liang

    Hmm... I'll just BUMP this to the top of the list, since no-one has answered yet...


  • Ozolayer

    Did you consider posting this in the directx forums as your probably more likely to get a response there as it is really a directx issue.

    The fact your writing code in VB is really rather irrelevent to the directx functionality which is language independent.

    http://forums.microsoft.com/MSDN/ShowForum.aspx ForumID=106&SiteID=1

    Also is there any reason you using directx7 and not the current version which I think is 9


  • GoatHunter

    No problem with posting to here - its just those guys/girls are more likely to give you a straight out answer with there methods than you'll get in the VB general forum.

    I'd still look to using latest versions of directx rather than earlier versions, it may take a bit more work to get to understand but learning on older versions often involves more headaches/heartaches when switching to a later version as functionality changes.


  • DirectDraw7 SemiTransparency?