Mithrandel
03-16-2002, 10:05 PM
So, here's the situation - two multi-thousand ton starships, bristling with enough weaponry to make any enemy's day go seriously downhill, are floating through space. One goes a little faster than the other, when suddenly...
BAM. The second starship reaches the edge of the screen, and disappears. Hum. This isn't good.
How am I supposed to clip dd7surfaces when they seach the edge of the screen to avoid this abrupt, un-intentional decloaking?
((Here's the code I'm currently using...))
Public Sub DisplaySprites()
Dim SrcRect As RECT
Dim i As Integer
Dim X As Integer, Y As Integer
'Set up the source rectangle
For i = 1 To UBound(Ships)
With SrcRect
.Bottom = Ships(i).Height
.Left = 0
.Right = Ships(i).Width
.Top = 0
End With
If i = 1 Then
'Blit the surface on to the backbuffer at the specified location, using the transparent color key of the source
X = (400 - (Ships(1).Width / 2))
Y = (300 - (Ships(1).Width / 2))
Call BackBuffer.BltFast(X, Y, Ship(Ships(1).Facing), SrcRect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
Else
X = (Ships(i).posX - Viewport.Left)
Y = (Ships(i).posY - Viewport.Top)
Call BackBuffer.BltFast(X, Y, Ship(Ships(i).Facing), SrcRect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
End If
Next i
End Sub
BAM. The second starship reaches the edge of the screen, and disappears. Hum. This isn't good.
How am I supposed to clip dd7surfaces when they seach the edge of the screen to avoid this abrupt, un-intentional decloaking?
((Here's the code I'm currently using...))
Public Sub DisplaySprites()
Dim SrcRect As RECT
Dim i As Integer
Dim X As Integer, Y As Integer
'Set up the source rectangle
For i = 1 To UBound(Ships)
With SrcRect
.Bottom = Ships(i).Height
.Left = 0
.Right = Ships(i).Width
.Top = 0
End With
If i = 1 Then
'Blit the surface on to the backbuffer at the specified location, using the transparent color key of the source
X = (400 - (Ships(1).Width / 2))
Y = (300 - (Ships(1).Width / 2))
Call BackBuffer.BltFast(X, Y, Ship(Ships(1).Facing), SrcRect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
Else
X = (Ships(i).posX - Viewport.Left)
Y = (Ships(i).posY - Viewport.Top)
Call BackBuffer.BltFast(X, Y, Ship(Ships(i).Facing), SrcRect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
End If
Next i
End Sub