Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Moving text on screen without leaving a trail

Author
Message
Snotrag
13
Years of Service
User Offline
Joined: 12th Aug 2011
Location:
Posted: 14th Aug 2011 11:34
Just wondering how I can make text move around the screen without it leaving a trail? Is there a command of some sort or do I need to CLS in the loop which leaves a very unsatisfactory flicker and not really ideal as everything has to be redrawn every frame?

Thanks in advance

He who goes to bed with itchy bottom....wakes up with smelly finger!
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 14th Aug 2011 12:58 Edited at: 14th Aug 2011 12:58
The flicker you are seeing is due to you letting DBPro redraw the display when it likes and not when best for your program - that's simple to fix though - you use SYNC ON at the top of your code, then use SYNC at the bottom of your loop as an instruction to redraw:


you have a choice between redrawing everything every frame, or of recording the differences so you can restore them later, but doing that means you need to read from the graphics card, and that's *s*l*o*w*:


As an indication of how much slower it is, the first piece of code runs at over 4000fps on my laptop, while the second runs at 64fps, or at 1.6% of the speed.

Basically, it's far faster to redraw everything except for the things you want to remove, than to try to undo them.

Login to post a reply

Server time is: 2024-11-24 02:24:37
Your offset time is: 2024-11-24 02:24:37