|
-
Dec 24th, 2001, 05:51 AM
#1
Thread Starter
Frenzied Member
Stop the flicker!!
How can I make my animation stop flicker!!!?!?!? 
Can I do it in the same way as with DDRAW, where all the animations are done on the sec. buffer???
Could anyone give an example???
My code:
VB Code:
Dim MovePic As Integer
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Sub Timer1_Timer()
Me.Cls
'Draws the mask with vbSrcAnd raster operation
BitBlt Me.hdc, MovePic, 0, picMask.ScaleWidth, picMask.ScaleHeight, picMask.hdc, 0, 0, vbSrcAnd
'Draws the sprite witht the vbSrcPaint raster operation
BitBlt Me.hdc, MovePic, 0, picSprite.ScaleWidth, picSprite.ScaleHeight, picSprite.hdc, 0, 0, vbSrcPaint
End Sub
Private Sub Timer2_Timer()
MovePic = MovePic + 2
End Sub
-
Dec 24th, 2001, 09:03 AM
#2
Junior Member
Do not use a timer
Hi, why don't you try to do it without a timer. How about:
Sub_Main()
Do
DoEvents
'Yer code here
Loop
End Sub
And were are you blitting it to? Me.cls make the Form clear. Try making a backbuffer with StretchBlt.
Hope this helps!
-
Dec 24th, 2001, 09:55 AM
#3
PowerPoster
Try making a backbuffer with StretchBlt.
? ? ?
-
Dec 24th, 2001, 10:34 AM
#4
Junior Member
Yes, like this:
Public Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
this goes into the module
Then make a picture box and do this in the main loop sub:
StretchBlt hdc, 0, 0, DispWidth, DispHeight, PB.hdc, 0, 0, 800, 600, vbSrcCopy
'The DispWidth and DispHeight are just integers.
like this:
DispWidth = Screen.Height * 1.315 / Screen.TwipsPerPixelY
DispHeight = Screen.Height * 0.975 / Screen.TwipsPerPixelY
From now on, everything you blit, you have to do it on the "PB" picturebox.
If this doesn't help, wait a bit. I'm writing a tutorial on BitBlt. It will be on my site at www.geocities.com/mman76dev
Hope this helps!
-
Dec 24th, 2001, 11:10 AM
#5
Thread Starter
Frenzied Member
thank you! I'll try it
-
Dec 24th, 2001, 12:03 PM
#6
PowerPoster
StrechBlt is crap!
Ok to answer your question fast, you need a backbuffer indeed. Check out my website/tutorial to learn how 
http://fox.acky.net/vb/
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
|