1 Attachment(s)
VB6 - Complete BitBlt Overview
Hi r33d3r,
Complete BitBlt Overview
Yikes! That sounds like ****! Well I won't get in to advanced since I'm quite new to BitBlt as well. (2 non-stop days of brain cracking got me my knowledge so far)
This topic will be updated with sources (for lazy people I guess, excuse me if I'm wrong ;)) and more questions.
!!! PLEASE DON'T REPLY, SEND ME A PRIVATE MESSAGE INSTEAD !!!
You should read this first!
So there we are workin' with masking and stuff.
Now we have some thing to watch out for!
I use BitBlt and the pictures need to be visible? Why!
No this isn't needed just do this:
VB Code:
Picture1.AutoRedraw = True
Picture1.Visible = False
Now BitBlt again and, see no picturebox but the BitBlt shows you what you wanted.
Masking is difficult! Is there another way to do this?
First you need to know that you COULD use masking. Though in many cases you don't need to really make things transparant. (This is a lazy way to accomplish things. ;)) Just equip the sprites with the unlayered tile now again this won't work in many occasions but sometimes this is just what we want and we don't need to do difficult masking.
My screen starts to flash a little every now and then (or worse ;))
Well this again is a AutoRedraw thing, I still can't find the use of letting this function on False but set
VB Code:
Picture1.AutoRedraw = True
then the flashes should've stopped.
Re: VB6 - Complete BitBlt Overview
Update I've added the attachment but you need to make the Form and Picture1 and Picture2!
Form1.Picture1.picture = a tiled background.
Form1.Picture2.picture = a single tile of Picture1 with a character or unit on it.
SET AutoRedraw to TRUE! On all pictureboxes ;)
On the Form1.Picture1 object KeyDown
This is the collision checking. (Very simple)
VB Code:
Private Sub Form1_KeyDown(KeyCode As Integer, Shift As Integer)
Dim tileFree As Boolean
Dim iCur As Long
iCur = 0
tileFree = True
Select Case KeyCode
Case 37
'Left
Do Until iCur = 255 Or tileFree = False
If tBush(iCur).iY = tUnit.iY Then If tBush(iCur).iX = tUnit.iX - 16 Then tileFree = False
iCur = iCur + 1
Loop
If tileFree = True Then tUnit.iX = tUnit.iX - 16
Case 38
'Up
Do Until iCur = 255 Or tileFree = False
If tBush(iCur).iX = tUnit.iX Then If tBush(iCur).iY = tUnit.iY - 16 Then tileFree = False
iCur = iCur + 1
Loop
If tileFree = True Then tUnit.iY = tUnit.iY - 16
Case 39
'Right
Do Until iCur = 255 Or tileFree = False
If tBush(iCur).iY = tUnit.iY Then If tBush(iCur).iX = tUnit.iX + 16 Then tileFree = False
iCur = iCur + 1
Loop
If tileFree = True Then tUnit.iX = tUnit.iX + 16
Case 40
'Down
Do Until iCur = 255 Or tileFree = False
If tBush(iCur).iX = tUnit.iX Then If tBush(iCur).iY = tUnit.iY + 16 Then tileFree = False
iCur = iCur + 1
Loop
If tileFree = True Then tUnit.iY = tUnit.iY + 16
Case 27
End
End Select
End Sub
Add this to the draw function, and add a Picture3 box for the unit
VB Code:
BitBlt form1.Picture1.hDC, tUnit.iX, tUnit.iY, 16, 16, Picture3.hDC, 0, 0, vbSrcCopy
Re: VB6 - Complete BitBlt Overview
please post sorce code for this (vb code)
Re: VB6 - Complete BitBlt Overview
Frozie, he said in his first post, not to post here, but to send him a private message instead. You may want to do so.