Print Page | Close Window

Set Transparent Color

Printed From: Mirage Source
Category: Tutorials
Forum Name: Temporary Archive (Read Only)
Forum Discription: Temporary 3.0.3 archive tutorials, will be deleted when converted.
URL: http://ms.shannaracorp.com/backup-forums/forum_posts.asp?TID=149
Printed Date: 20 December 2006 at 5:52pm
Software Version: Web Wiz Forums 8.01 - http://www.webwizforums.com


Topic: Set Transparent Color
Posted By: Sync
Subject: Set Transparent Color
Date Posted: 11 February 2006 at 3:07pm
Difficulty: Medium 4/5

Originaly Posted By: Solosturm

ok, some people could get this to work, some could not, .... it worked for me, but i think that i had to figure out the trick to it also, Any way, made by Enigmewave...

In the client, open modDirectX.bas and add this sub:
'Code:
Public Sub SetMaskColorFromPixel(ByRef TheSurface As DirectDrawSurface7, ByVal X As Long, ByVal Y As Long)
Dim TmpR As RECT
Dim TmpDDSD As DDSURFACEDESC2
Dim TmpColorKey As DDCOLORKEY

With TmpR
.Left = X
.Top = Y
.Right = X
.Bottom = Y
End With

TheSurface.Lock TmpR, TmpDDSD, DDLOCK_WAIT Or DDLOCK_READONLY, 0

With TmpColorKey
.low = TheSurface.GetLockedPixel(X, Y)
.high = .low
End With

TheSurface.SetColorKey DDCKEY_SRCBLT, TmpColorKey

TheSurface.Unlock TmpR
End Function


'Then in the InitSurfaces sub
'replace:
'Code:
DD_SpriteSurf.SetColorKey DDCKEY_SRCBLT, key
'with:
'Code:

SetMaskColorFromPixel DD_SpriteSurf, 0, 0


'replace:
'Code:
DD_TileSurf.SetColorKey DDCKEY_SRCBLT, key
'with:
'Code:

SetMaskColorFromPixel DD_TileSurf, 0, 0


'and replace:
'Code:
DD_ItemSurf.SetColorKey DDCKEY_SRCBLT, key
'with:
'Code:

SetMaskColorFromPixel DD_ItemSurf, 0, 0


'After that, whatever color the topleft pixel is on the sprites surface, tiles surface, or items surface will be the transparent color for that surface.



Print Page | Close Window

Bulletin Board Software by Web Wiz Forums version 8.01 - http://www.webwizforums.com
Copyright ©2001-2006 Web Wiz Guide - http://www.webwizguide.info