|
-
Jul 3rd, 2001, 06:18 PM
#1
Thread Starter
New Member
Newbie code needs help with BitBlt
I am using BitBlt, but only my background is showing up, and not the player's unit (a 'tank')
no, this isn't ALL the code, but i tried to keep it at a minimum 4 u.
Here are some things u should know that appear in my code:
main = form (visible)
pic = form (invisible)
mask(0 - 7) = picture boxes
tank(0 - 7) = picture boxes
desert = picture box (background image)
'-------------GLOBAL .BAS CODE----------------------------------------
Type TypeTank
X As Integer
Y As Integer
Width As Integer
Height As Integer
Alive As Integer
Ammo As Integer
Score As Integer
Lives As Integer
XSpeed As Integer
YSpeed As Integer
Direction As Integer
End Type
'-------------FORM MAIN CODE------------------------------------------
Private Sub DrawTank()
' Erase old contents
BitBlt pic.Buffer.hdc, 0, 0, 32, 32, pic.Desert.hdc, Player1.X, Player1.Y, vbSrcCopy
' Mask
BitBlt pic.Buffer.hdc, 0, 0, 32, 32, pic.Mask(Player1.Direction), 0, 0, vbSrcAnd
' Fill Mask with tank
BitBlt pic.Buffer.hdc, 0, 0, 32, 32, pic.Tank(Player1.Direction), 32, 32, vbSrcPaint
' Copy buffer to form
BitBlt main.hdc, Player1.X, Player1.Y, 32, 32, pic.Buffer.hdc, 0, 0, vbSrcCopy
End Sub
'----------------------------------------------------------------------------
Click HERE to email me the answer
What am i doing wrong?
It used to work until it got messed somewhere along the line...
-theplant
Reply soon 
-
Jul 3rd, 2001, 07:36 PM
#2
Addicted Member
Make sure autoredraw is set to true first. Then if that doesn't work try refreshing the picture box.
Example:
picBuffer.refresh
Tell me is this "pic.Buffer.hdc" a mistake? Shouldn't it be "picBuffer.hdc"? You know without the extra period?
Anyways, I hope this helped.
Drewski
I see said the blind man as he spat into the wind.
It all comes back to me now!
A.D.T.'s VB
-
Jul 4th, 2001, 03:05 AM
#3
Fanatic Member
Try using OffscreenDC to load your pictures,
and then BitBlt them into the form!
Arie.
-
Jul 4th, 2001, 05:54 AM
#4
PowerPoster
And if you still need help try my tutorial or BitBlt demo
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
|