|
-
Jan 22nd, 2001, 11:33 PM
#1
Thread Starter
Addicted Member
I've got myself an isometric engine partially written. Here's the blitting routine.
Code:
Private Sub BitBltMap()
Dim TempX As Integer
Dim TempY As Integer
On Error Resume Next
TacPic.Cls
For Y = 1 To 22
For X = 0 To 16
TempX = ((XOffSet + Y) + (YOffSet + (X - (MapYSize \ 2))))
TempY = ((XOffSet + Y) - (YOffSet + (X - (MapYSize \ 2))))
If Not TempX < 1 And Not TempY < 1 And Not TempX > MapXSize And Not TempY > MapYSize Then
BitBlt TacPic.hDC, (X * 40) - 20, (Y * 20) - 20, 40, 19, TileSource.hDC, (Map(TempX, TempY, 1) - 1) * 40, 19, vbSrcAnd
BitBlt TacPic.hDC, (X * 40) - 20, (Y * 20) - 20, 40, 19, TileSource.hDC, (Map(TempX, TempY, 1) - 1) * 40, 0, vbSrcPaint
End If
Next X
For X = 1 To 16
TempX = ((XOffSet + Y) + (YOffSet + (X - (MapYSize \ 2))))
TempY = ((XOffSet + Y) - (YOffSet + (X - (MapYSize \ 2))))
If Not TempX - 1 < 1 And Not TempY < 1 And Not TempX - 1 > MapXSize And Not TempY > MapYSize Then
BitBlt TacPic.hDC, (X * 40) - 40, (Y * 20) - 30, 40, 19, TileSource.hDC, (Map(TempX - 1, TempY, 1) - 1) * 40, 19, vbSrcAnd
BitBlt TacPic.hDC, (X * 40) - 40, (Y * 20) - 30, 40, 19, TileSource.hDC, (Map(TempX - 1, TempY, 1) - 1) * 40, 0, vbSrcPaint
End If
Next X
Next Y
End Sub
How do I figure out the square location of the mouse ? (FYI, the 1 in the 3rd array value is a placeholder for the z-axis)
Btw I'll be converting over to Direct Draw soon enough, don't worry. 
-Git
-
Jan 27th, 2001, 12:53 PM
#2
Frenzied Member
Isometric engines have a problem: half of each tile is not blted, which makes it slower than it should...
So, it would be better to have a lookup table with the positions of the pixels we have to blt! What do you think?
-
Jan 27th, 2001, 04:25 PM
#3
Member
Actually, in a well-designed iso engine, that attribute can make it go *faster* than a standard engine, believe it or not. It can also allow it to take less memory for each image.
git's code has one majour inneficiency (besides the fact that it uses BitBlt, which does draw, actually, *4* times as much as it needs to -- first the mask, then the image, both of which are twice as large as is necessary), and that's that it uses multiplication for each tile. A series of cumulative additions would be much faster, but the effect would be negated by BitBlt's legendary slowness.
*Anyway* ... this is just a simple case of solving for two variables given two formulae. That's pretty easy (subtraction, anyone ???)
-
Jan 28th, 2001, 08:07 AM
#4
Frenzied Member
Ok. But still, even with DX, I think it uses too many calculations inside a double loop...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|