Original Post
That''s my code for fade in DirectX. DXObject is my own type, don''t worry about it.
But anyway, what should I add to this code to make the picture flash (fade in/out)? I could make a series of pictures and then show them, but I need to keep the game as small as possible.
Public Sub Fade(dxo As DXObject, m As SngPoint, transcol As Long)
Dim xx As Integer, xy As Integer ''coordinates
Dim rl As Long ''color
Dim colorDivided As RGBTRIPLE
If InsideRect(dxo.sRect2, m.x, m.y) Then
dxo.DDSurface.Lock dxo.sRect2, dxo.ddsd, DDLOCK_WAIT, 0
For xy = 0 To dxo.ddsd.lHeight
For xx = 0 To dxo.ddsd.lWidth
rl = dxo.DDSurface.GetLockedPixel(xx, xy)
If rl = transcol Then GoTo zskip ''prevents the change of transparent color
colorDivided.rgbtRed = rl And &HFF&
colorDivided.rgbtGreen = (rl And &HFF00&) \ 256
colorDivided.rgbtBlue = (rl And &HFF0000) \ 65536
Call dxo.DDSurface.SetLockedPixel(xx, xy, RGB(colorDivided.rgbtRed / 2, colorDivided.rgbtGreen / 2, colorDivided.rgbtBlue / 2))
zskip:
Next
Next
dxo.DDSurface.Unlock dxo.sRect2
End If
End Sub