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 / cls in loop

Author
Message
HeavyAmp
18
Years of Service
User Offline
Joined: 25th Oct 2006
Location: Castle in the Sky!
Posted: 31st Mar 2007 06:00
I read in the 2d section that using the cls every loop was inefficient . I have always been doing this in my code. Is this true?
Veron
18
Years of Service
User Offline
Joined: 22nd Nov 2006
Location:
Posted: 31st Mar 2007 06:14
Well, if you use CLS in a loop, it'll continuously clear the screen. No real point to it, as you'll never see anything on the screen, as it's continuously being cleared.

Need web design help with PHP or XHTML? E-mail me!
http://veron.sitesled.com Visit Veron! Free games, programs and applications! Made in DBPRO, FPSC, and C++!
Quisco DaLuse
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: USA
Posted: 31st Mar 2007 07:37
@HeavyAmp

I believe you are talking about a do - loop that clears the screen, draws some images, gets user input and updates the positions of those images and then goes back to the start of the do - loop to start the process over.

Clearing the entire screen and then pasting images on the screen is definitely not the most efficient way to write 2D programs in most all cases (there would be some exceptions). Sprites are designed to allow drawing to take place very quickly and should be used in 2D programs to move images quickly across the screen.

Sure, you can write a program that uses a cls in the do - loop and it will work, but it's probably not the most efficient way to do it.

You idiots! You've captured their stunt doubles!
HeavyAmp
18
Years of Service
User Offline
Joined: 25th Oct 2006
Location: Castle in the Sky!
Posted: 31st Mar 2007 16:19
Ok thanks Quisco,ill keep that in mind when im writing my games.
Johnathon
17
Years of Service
User Offline
Joined: 20th Feb 2007
Location: South Park
Posted: 1st Apr 2007 14:25
you could have cls in a loop. Here's an example

Login to post a reply

Server time is: 2024-11-25 22:29:43
Your offset time is: 2024-11-25 22:29:43