PDA

Click to See Complete Forum and Search --> : Whats the matter with....


LBS
May 9th, 2002, 01:45 PM
Public Sub LoadSprite(ByRef Sprite As DirectDrawSurface7, File As String, bWidth As Integer, bHeight As Integer, ColourKey As Integer)

Dim CKey As DDCOLORKEY
Dim ddsdNewSprite As DDSURFACEDESC2

'This routine loads sprites in the FObject file and sets their colour keys
ddsdNewSprite.lFlags = DDSD_CAPS Or DDSD_WIDTH Or DDSD_HEIGHT 'Set the surface description to include the Capabilities, Width and Height
ddsdNewSprite.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN 'Set the surface's capabilities to be an offscreen surface
ddsdNewSprite.lWidth = bWidth 'Set the width of the surface
ddsdNewSprite.lHeight = bHeight 'Set the height of the surface
THIS? -> Set Sprite = dd.CreateSurfaceFromResource("", File, ddsdNewSprite) 'Load the bitmap from the resource file into the surface using the surface description
CKey.low = ColourKey 'Set the low value of the colour key
CKey.high = ColourKey 'and the high value (in this case they're the same because we're not using a range)
Sprite.SetColorKey DDCKEY_SRCBLT, CKey 'Set the sprites colourkey using the key just created

End Sub
Thanks

Hack
May 9th, 2002, 02:13 PM
What error do you get?

LBS
May 9th, 2002, 02:40 PM
Automation Error

petrus
May 9th, 2002, 04:50 PM
These automation errors can come up even if there isn't really a error! that error gets me often! i hate it!!!
HATE AUTOMATION ERROR!
But, i think the error has something to do with that line...:confused: