Mirage Source
Need help with Alpha Blending - Printable Version

+- Mirage Source (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: General (https://mirage-engine.uk/forums/forumdisplay.php?fid=17)
+---- Thread: Need help with Alpha Blending (/showthread.php?tid=567)



Need help with Alpha Blending - halla - 02-01-2007

Ok I tried the tutorial on vbgamer website.

Code:
Dim rEmptyRect As RECT, dArray() As Byte, sArray() As Byte

MainMenu.Lock rEmptyRect, DDSDMainMenu, DDLOCK_WAIT, 0
DD_PrimarySurf.Lock rEmptyRect, DDSD_Primary, DDLOCK_WAIT, 0

MainMenu.GetLockedArray dArray()
DD_PrimarySurf.GetLockedArray sArray()

Call vbDABLalphablend16(555, 0, sArray(0 + 0, 0), dArray(0 + 0, 0), 200, 64, 32, DDSD_Primary.lPitch, DDSDMainMenu.lPitch, 0)

DD_PrimarySurf.Unlock rEmptyRect
MainMenu.Unlock rEmptyRect

I put that in Form Load of frmMirage.

I also have the DLL file called too.

in modDirectX I have...

Code:
Public DX As New DirectX7
Public DD As DirectDraw7
Public DD_PrimarySurf As DirectDrawSurface7
Public DD_SpriteSurf As DirectDrawSurface7
Public DD_TileSurf As DirectDrawSurface7
Public DD_ItemSurf As DirectDrawSurface7
Public DD_BackBuffer As DirectDrawSurface7
Public DD_Clip As DirectDrawClipper
Public MainMenu As DirectDrawSurface7

Public DDSD_Primary As DDSURFACEDESC2
Public DDSD_Sprite As DDSURFACEDESC2
Public DDSD_Tile As DDSURFACEDESC2
Public DDSD_Item As DDSURFACEDESC2
Public DDSD_BackBuffer As DDSURFACEDESC2
Public DDSDMainMenu As DDSURFACEDESC2

It will compile but gets an error with... MainMenu.Lock rEmptyRect, DDSDMainMenu, DDLOCK_WAIT, 0

If someone could help me out here... or if someone could even do 1 for me so I can learn how it works and do the rest. I dont understand these guides or anything much. I could repay you back in some way im sure.

Reply or get at me on AIM or MSN.


- Tony - 02-01-2007

Ooo I want to try this. Link me plx. :]

:: Pando


- Spodi - 02-01-2007

You can try the people at http://www.gpwiki.org - though they do a good job arguing about tiny things instead of answering questions. :wink:


- halla - 02-01-2007

Ok im getting close. Went to pscode and found this source.

Heres what I got in form load

Code:
picTest.Picture = picMainMenu.Picture
    
    With BF
        .BlendOp = AC_SRC_OVER
        .BlendFlags = 0
        .SourceConstantAlpha = 50
        .AlphaFormat = 0
    End With

    RtlMoveMemory lBF, BF, 4
    
    AlphaBlend picTest.hdc, 0, 0, picTest.ScaleWidth, picTest.ScaleHeight, picScreen.hdc, 0, 0, picScreen.ScaleWidth, picScreen.ScaleHeight, lBF

    picMainMenu.Refresh
    picTest.Refresh
    picScreen.Refresh

I want MainMenu to alphablend with the screen... should I use picScreen or something else to get that?

Right now it just shows the mainmenu but no effects... it compiles fine and all. I also have the calls that are needed on mod Constants. If you want to see them let me know.