If you are refering to transparency as alphablending, I believe it's unfortunately only possible using Direct3D and using TLVertex for 2D. Probably beyond your skills since you just started learning DirectX. But if you want source code anyways on it let me know.
If you are refering to transparency as removing the background color from the sprite so only the spite is blitted, look in the LoadSprite:
VB Code:
Public Sub LoadSprite(ByRef Sprite As DirectDrawSurface7, File As String, bWidth As Integer, bHeight As Integer, [b]ColourKey As Integer[/b])
[b]Dim CKey As DDCOLORKEY[/b]
Dim ddsdNewSprite As DDSURFACEDESC2
'This routine loads sprites in the FObject file and sets their colour keys
ddsdNewSprite.lFlags = DDSD_CAPS Or DDSD_WIDTH Or DDSD_HEIGHT 'Set the surface description to include the Capabilities, Width and Height
ddsdNewSprite.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN 'Set the surface's capabilities to be an offscreen surface
ddsdNewSprite.lWidth = bWidth 'Set the width of the surface
ddsdNewSprite.lHeight = bHeight 'Set the height of the surface
Set Sprite = dd.CreateSurfaceFromResource("", File, ddsdNewSprite) 'Load the bitmap from the resource file into the surface using the surface description
[b] CKey.low = ColourKey 'Set the low value of the colour key
CKey.high = ColourKey 'and the high value (in this case they're the same because we're not using a range)
Sprite.SetColorKey DDCKEY_SRCBLT, CKey 'Set the sprites colourkey using the key just created
[/b]
End Sub
In bold is a little bit of the code that will help produce transparency. Now when you call it:
VB Code:
LoadSprite Ship(0).Surface(i), "vegan" & i, Ship(0).Width, Ship(0).Height, [b]vbBlack[/b]
your image's background color that was in your bitmap file (Black) will be your source color key that you want transparent. If you want more choices in colors, here are some constants you can use to replace vbblack:
VB Code:
Public Const Transparent_Black As Long = &HFF000000
Public Const Transparent_Red As Long = &HFFFF0000
Public Const Transparent_Green As Long = &HFF00FF00
Public Const Transparent_Blue As Long = &HFF0000FF
Public Const Transparent_Magneta As Long = &HFFFF00FF
Public Const Transparent_Yellow As Long = &HFFFFFF00
Public Const Transparent_Cyan As Long = &HFF00FFFF
Public Const Transparent_White As Long = &HFFFFFFFF
'or instead of a Hexadecimal value,
'use &HFF000000 + RGB(Red,Green,Blue)
And when you blit it, one of the contsants you need to use is
DDBLT_KEYSRC
VB Code:
BackBuffer.Blt DestRect, Ship(Current_Sprite).Surface(Ship(Current_Sprite).Facing), SrcRect, [b]DDBLT_KEYSRC[/b] Or DDBLT_WAIT
If you want non transparent sprites, just add Transparency As Boolean into the Sprite type and do this when blitting:
VB Code:
If Ship(Current_Sprite).Transparency = True Then
BackBuffer.Blt DestRect, Ship(Current_Sprite).Surface(Ship(Current_Sprite).Facing), SrcRect, [b]DDBLT_KEYSRC[/b] Or DDBLT_WAIT
Else
BackBuffer.Blt DestRect, Ship(Current_Sprite).Surface(Ship(Current_Sprite).Facing), SrcRect, DDBLT_WAIT
End If
There ya go. A nice easy and quick tutorial on Transparency using DirectX7.