Posts: 2
Threads: 1
Joined: Apr 2006
I wrote a program that draws a circle, paints it, then clears the screen and draws a -3 smaller circle, paints it, etc. It's doing what I want, but because of the CLS, it's VERY flickery. Is there a way to get the same result without the flicker? Thanks, Richard
Posts: 2,771
Threads: 96
Joined: Oct 2003
http://faq.qbasicnews.com/?blast=DoubleBufferingGeneral
;)
If it confuses you, scroll all the way down to the bottom and have a look at the example. Try it out yourself, then try play with it a bit.
Posts: 938
Threads: 104
Joined: Dec 2002
One thing that you could do (that is less confusing than double buffering)...
Just make a black box around the circle that you want to delete:
Line (x,y)-(x2,y2),0,BF
then it's like clearing the screen but it only blots out what you don't want, reducing flicker. It's not perfect, and it's not as nice as double-buffering, but it works quite well for simple stuff.
ovaProgramming.
One night I had a dream where I was breaking balls. The next morning,
BALLSBREAKER was born.
Quote: Excellent. Now you can have things without paying for them.
BALLSBREAKER 2
~-_-Status Report-_-~
Engine: 94%
Graphics: 95%
Sound: 100%
A Severe Error has crippled BB2 for the time being... I have to figure it out, but until then you won't see much of it
.
-----------------------------
Posts: 2
Threads: 1
Joined: Apr 2006
Thanks for the suggestions!
Posts: 961
Threads: 81
Joined: Apr 2005
cha0s, might I suggest telling him what this piece of code does?
What it does is waits for your monitor to clear the current cycle and start afresh, so your program is drawing with the monitor on it's cycle than having it draw 1 frame over two monitor cycles, or two over 1 cycle...
Insert that into your loop right before you start drawing. Using this in combination with double buffering, ie: before the page flip, makes things a whole lot smoother.
Good luck.
Screwing with your reality since 1998.
search the forum gfor my name and that code snippet.
you can only say the same thing so many million times, so... you can do it now ^^
Posts: 3,522
Threads: 189
Joined: Dec 2003
Posts: 3,522
Threads: 189
Joined: Dec 2003
Quote:...come again? o.o
Topic title.