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?
Printable View
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?
You might try drawing a solid colored rectangle over your screen:
Also, You could try just Bltting your background over everything that has been drawn, thus clearing.Code:Me.Line(0, 0)-(640, 480), vbWhite, BF
Z.
Line, Zaei?
Yup. The "BF" Parameter tells the line function to draw a Box, and Fill it with the color parameter.
Z.
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? ;)
Change the co-ordinates in Zaei's code.
Draw the Box to the back buffer to avoid the flicker.
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)Quote:
Originally posted by Zaei
You might try drawing a solid colored rectangle over your screen:
Also, You could try just Bltting your background over everything that has been drawn, thus clearing.Code:Me.Line(0, 0)-(640, 480), vbWhite, BF
Z.
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.