VBGamer |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Clipping problems.. Warder (7 replies, 0 views) (2000-Jul-4) ** I hate it when the web board erases your message grrrr**
So this is a repost..
Ive tried using Directdraw clipper, but that doesnt work, I even tried using lucky's clipping, voodoovb cliipping, and, I think robs (cant remember his real name) clipping, none works, so this is my last resort here....
I'll post my code here, and see if you guys can figure out whats wrong. The bottom and right clipping works, however the top and left clipping wont work at all. It just makes the graphics disappear.
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
' .Left = .Left + (intTileX + GfxData(bytTileNumber).sX) ' (intTileX * 32)
'.Right = GfxData(bytTileNumber).sX + GfxData(bytTileNumber).pixelWidth - intTileX
' intTileX = 0
'End If
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
'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 right side of the screen...
' If intTileX + 32 > SCREEN_WIDTH Then .Right = .Right + (SCREEN_WIDTH - (intTileX + 32))
'If this tile is off the bottom of the screen...
' If intTileY + 32 > SCREEN_HEIGHT Then .Bottom = .Bottom + (SCREEN_HEIGHT - (intTileY + 32))
End With
End If
End Sub
As you might be able to see, there is no set tile width, since each "tile", which includes houses and trees, are different height and width...
offset is 0. This is based off of Lucky's TileScroll sample, but he couldnt help so...
|