ok, this may help, here's the code I've used up to now (except the dims, saving time):
InitDirectX
Code:
Sub InitDirectX()
' Initialize direct draw
Set DD = DX.DirectDrawCreate("")
Set DD2 = DX.DirectDrawCreate("")
frmMirage.Show
' Indicate windows mode application
Call DD.SetCooperativeLevel(frmMirage.hWnd, DDSCL_NORMAL)
Call DD2.SetCooperativeLevel(frmBattleWindow.hWnd, DDSCL_NORMAL)
' Init type and get the primary surface
DDSD_Primary.lFlags = DDSD_CAPS
DDSD_Primary.ddsCaps.lCaps = DDSCAPS_PRIMARYSURFACE
Set DD_PrimarySurf = DD.CreateSurface(DDSD_Primary)
'Monster One
DDSD2_Primary.lFlags = DDSD_CAPS
DDSD2_Primary.ddsCaps.lCaps = DDSCAPS_PRIMARYSURFACE
Set DD2_PrimarySurf = DD2.CreateSurface(DDSD2_Primary)
' Create the clipper
Set DD_Clip = DD.CreateClipper(0)
Set DD2_Clip = DD2.CreateClipper(0)
' Associate the picture hwnd with the clipper
DD_Clip.SetHWnd frmMirage.picScreen.hWnd
DD2_Clip.SetHWnd frmBattleWindow.picScreen.hWnd
' Have the blits to the screen clipped to the picture box
DD_PrimarySurf.SetClipper DD_Clip
DD2_PrimarySurf.SetClipper DD2_Clip
' Initialize all surfaces
Call InitSurfaces
Call InitSurfaces2
End Sub
Initsurfaces2
Code:
Sub InitSurfaces2()
Dim Key As DDCOLORKEY
If FileExist("/GFX/monsters/monsters.bmp") = False Then
Call MsgBox("Your Monster graphics are not available, please download the game again.", vbCritical, "Graphics Error!")
Call GameDestroy
End If
Key.low = 0
Key.high = 0
' Initialize MONSTER back buffer
DDSD2_BackBuffer.lFlags = DDSD_CAPS Or DDSD_HEIGHT Or DDSD_WIDTH
DDSD2_BackBuffer.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN Or DDSCAPS_SYSTEMMEMORY
DDSD2_BackBuffer.lWidth = frmbattlewindow.picscreen.width
DDSD2_BackBuffer.lHeight = frmbattlewindow.picscreen.height
Set DD2_BackBuffer = DD2.CreateSurface(DDSD2_BackBuffer)
' Init Monsters ddsd type and load the bitmap
DDSD2_MONSTERS.lFlags = DDSD_CAPS
DDSD2_MONSTERS.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN Or DDSCAPS_SYSTEMMEMORY
Set DD2_MONSTERSsurf = DD2.CreateSurfaceFromFile(App.Path & "\GFX\monsters\monsters.bmp", DDSD2_MONSTERS)
DD2_MONSTERSsurf.SetColorKey DDCKEY_SRCBLT, Key
End Sub
Now the jumbled up bit, a sub that's called when battle window is open, containing these things:
Code:
'Rec Place
rec2.top = 0
rec2.Bottom = 127
rec2.Left = 0
rec2.Right = 127
M1X = 100
M1Y = 100
Call DD2_BackBuffer.BltFast(M1X, M1Y, DD2_MONSTERSsurf, rec2, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
TexthDC = DD2_BackBuffer.GetDC
rec2.top = 0
rec2.Bottom = rec2.top + frmBattleWindow.picScreen.Height
rec2.Left = 0
rec2.Right = rec2.Right + frmBattleWindow.picScreen.Width
' Release DC
Call DD2_BackBuffer.ReleaseDC(TexthDC)
' Get the rect to blit to
Call DX2.GetWindowRect(frmBattleWindow.picScreen.hWnd, rec_pos2)
rec_pos2.Bottom = rec_pos2.top + frmBattleWindow.picScreen.Height
rec_pos2.Right = rec_pos2.Left + frmBattleWindow.picScreen.Width
' Blit the backbuffer
Call DD2_PrimarySurf.Blt(rec_pos2, DD2_BackBuffer, rec2, DDBLT_WAIT)
Anyone see any problems? :S[/code]
_________________
Fallen Phoenix Online:
An online game world based on the Harry Potter books
www.fallenphoenix.org