|
-
Aug 28th, 2002, 01:43 PM
#1
Thread Starter
Addicted Member
.Cls is slow!!!! Anything fast to replace it?
I know why my game only gets 13 fps! I used the .cls to clear my background. Then I set it to .refresh, I get over 80 fps! but nothing clears. Anything else I could try?
-
Aug 28th, 2002, 03:07 PM
#2
Frenzied Member
You might try drawing a solid colored rectangle over your screen:
Code:
Me.Line(0, 0)-(640, 480), vbWhite, BF
Also, You could try just Bltting your background over everything that has been drawn, thus clearing.
Z.
-
Aug 28th, 2002, 03:31 PM
#3
Good Ol' Platypus
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Aug 28th, 2002, 03:42 PM
#4
Frenzied Member
Yup. The "BF" Parameter tells the line function to draw a Box, and Fill it with the color parameter.
Z.
-
Aug 28th, 2002, 04:19 PM
#5
Thread Starter
Addicted Member
Huh, what is that suppose to do? Anyways, I tried it and it makes my screen flicker. I've had about enough of this stupid VB graphic routines > , it's time to start porting my game to DirectX.
Oh yeh, one quick question, can I cls just a part of a picture and not the whole thing?
-
Aug 28th, 2002, 04:24 PM
#6
Hyperactive Member
Change the co-ordinates in Zaei's code.
-
Aug 28th, 2002, 04:37 PM
#7
Frenzied Member
Draw the Box to the back buffer to avoid the flicker.
Z.
-
Aug 28th, 2002, 05:13 PM
#8
Fanatic Member
Originally posted by Zaei
You might try drawing a solid colored rectangle over your screen:
Code:
Me.Line(0, 0)-(640, 480), vbWhite, BF
Also, You could try just Bltting your background over everything that has been drawn, thus clearing.
Z.
using the built in wraper functions in vb is a slower method. set your properties like forecolor, fillcolor, and fillstyle and then use the api to draw the rectangle. it will use the brush of the dc you draw to, which incidently is set by the properties you just changed (i.e. fillcolor)
-
Aug 28th, 2002, 05:48 PM
#9
Frenzied Member
Some wrappers are slower, and Line is one of them. PaintPicture is not, just for the sake of example. On the other hand, if you need to draw lines, or rectangles of different colors, then you lose the advantages gained because everytime you set a color proprty for instance, VB will automatically re-generate the brush, slowing down the code.
Z.
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
|