PDA

Click to See Complete Forum and Search --> : SRCBLT in DX7 How do I change the color!


drewski
Feb 18th, 2001, 07:25 PM
Dim key As DDCOLORKEY
key.high = 0 'this is black
key.low = 0 'this is black

Sprite.SetColorKey DDCKEY_SRCBLT, key


The problem is i want to make the transparent color something other than black. I've tried giving it the value using RGB() but it didn't work. I tried a some others like DXRGB or something and it didn't work either. If any one knows how to do this I'd sure appreciate the help.

drewski

drewski
Feb 19th, 2001, 11:05 PM
can i get some feed back here people?

YoungBuck
Feb 20th, 2001, 12:08 AM
I'm not really sure if this will work but it is worth a try anyway, I can't test because I don't have DX on my CPU anymore but please let me know if it works or not, it sounds like you need to get the hiword and loword of the long color value.....



Private Sub Form_Load()
Dim c As Long
Dim hi As Integer, lo As Integer
Dim Key as DDCOLORKEY

c = RGB(255, 125, 63) ' define some weird color

hi = HiWord(c)
lo = LoWord(c)

Key.high = hi
Key.low = lo

Sprite.SetColorKey DDCKEY_SRCBLT, key


End Sub

Public Function HiWord(wParam As Long) As Integer

If wParam And &H80000000 Then
HiWord = (wParam \ 65535) - 1
Else
HiWord = wParam \ 65535
End If

End Function


Public Function LoWord(wParam As Long) As Integer

If wParam And &H8000& Then
LoWord = &H8000 Or (wParam And &H7FFF&)
Else
LoWord = wParam And &HFFFF&
End If

End Function

drewski
Feb 20th, 2001, 08:08 PM
ill check it out


by the way i reuse 100% of my 'software' ;)