20-01-2007, 05:06 PM
Well, currently I am working on an alpha fading way of doing day/night. What I have basically done is download a few codes from pscode and read a lot of stuff and have sort of learned it a bit. I am using the code from MRPGE and am not sure why I cannot get it working. I have had it so it flashes on the screen but thats all. So here is the code I am using.
In my GameLoop
The SquareAlphaBlend sub
Thats it, I have a big black picture box on frmMirage which should be blended onto the picScreen. The alphablend api is the same as any. If maybe there is an easier way of doing this and more efficient that would be nice to find out, thanks a lot for any help.
In my GameLoop
Code:
' Draw night
Call SquareAlphaBlend(frmMirage.picScreen.Width, frmMirage.picScreen.Height, frmMirage.picScreen.hdc, 0, 0, frmMirage.picBlack.hdc, 0, 0, 110)
The SquareAlphaBlend sub
Code:
Public Sub SquareAlphaBlend( _
ByVal cSrc_Widht As Integer, _
ByVal cSrc_Height As Integer, _
ByVal cSrc As Long, _
ByVal cSrc_X As Integer, _
ByVal cSrc_Y As Integer, _
ByVal cDest As Long, _
ByVal cDest_X As Integer, _
ByVal cDest_Y As Integer, _
ByVal nLevel As Byte)
Dim LrProps As rBlendProps
Dim LnBlendPtr As Long
LrProps.tBlendAmount = nLevel
CopyMemory LnBlendPtr, LrProps, 4
AlphaBlend cDest, cDest_X, cDest_Y, cSrc_Widht, cSrc_Height, cSrc, cSrc_X, cSrc_Y, cSrc_Widht, cSrc_Height, LnBlendPtr
End Sub
Thats it, I have a big black picture box on frmMirage which should be blended onto the picScreen. The alphablend api is the same as any. If maybe there is an easier way of doing this and more efficient that would be nice to find out, thanks a lot for any help.