VBGamer |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Clipping Woes..... Warder (3 replies, 0 views) (2000-Jul-4) Ok, I'll post my clipping routine here and see if you guys can make heads or tells of it.. Also, DirectDraw's Clipper doesnt work at all.... waste of time, so I need a custom clipper...
Private Sub GetRect(bytTileNumber As Byte, ByRef intTileX As Integer, ByRef intTileY As Integer, ByRef rectTile As RECT)
Dim i As Integer
If bytTileNumber <> 0 Then
'Me.Caption = GfxData(bytTileNumber).pixelWidth
With rectTile
'.Left = 0
.Left = GfxData(bytTileNumber).sX
.Right = GfxData(bytTileNumber).sX + GfxData(bytTileNumber).pixelWidth
'.Right = .Left & GfxData(bytTileNumber).pixelWidth
'.Top = 64
.Top = GfxData(bytTileNumber).sY
'.Bottom = .Top + TILE_HEIGHT
.Bottom = .Top + GfxData(bytTileNumber).pixelHeight 'GfxData(bytTileNumber).pixelHeight
'Clip rect
'If this tile is off the right side of the screen...
If intTileX + GfxData(bytTileNumber).pixelWidth > SCREEN_WIDTH Then .Right = .Right + (SCREEN_WIDTH - (intTileX + GfxData(bytTileNumber).pixelWidth))
'If this tile is off the bottom of the screen...
If intTileY + GfxData(bytTileNumber).pixelHeight > SCREEN_HEIGHT Then .Bottom = .Bottom + (SCREEN_HEIGHT - (intTileY + GfxData(bytTileNumber).pixelHeight))
'If this tile is off the left side of the screen...
If intTileX < 0 Then
i = 0 - intTileX
intTileX = intTileX + i
.Left = .Left + i
End If
'If this tile is off the top of the screen...
If intTileY < 0 Then
.Top = .Top - intTileY
intTileY = 0
End If
End Sub
AS you can probably see, there is no Tile_Width Const, due to the fact that the only tiles that are 32x32 are the ground tiles. All other tiles are various sizes...
|