Jump to content
  • Advertisement
Sign in to follow this  
Sabonis

console game

This topic is 4829 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

is there any real easy way to clear a console while running your game? I'm thinking it would clean up my console game really good not having all the previous text above that makes things hard to read.

Share this post


Link to post
Share on other sites
Advertisement
Please specify the language and environment you are using...

.NET 2.0 has a lot of nice console commands...

Cheers

Share this post


Link to post
Share on other sites
Without knowing what programming language you're using it's hard to make more than a general recommendation. Did you try just printing out a bunch of new lines?

Share this post


Link to post
Share on other sites
You could print x '\n' where x is the maximum number of rows, or if you know you are on windows you could use "system("clr");". There is probably better ways than these, but those where the one I used when programming console games.

EDIT: Assumed you where using C++, the '\n' could be used in other languages too, but the system("clr") would be used in another way.

Share this post


Link to post
Share on other sites
What language/platform/OS are you developing for/on? If you're using windows you can clear the console using the FillConsoleOutputCharacter(), FillConsoleOutputAttribute() or FillConsoleOutputCharacter() Win32 API functions to fill the visible area with the desired character/color.

arm

Share this post


Link to post
Share on other sites
I was actually wondering the same thing as the original poster... What I think he means is, is there someway to clear the screen, much like the BASIC command 'CLS'.

I know of an old trick where you could write directly to the video memory at 0x800 for monochrome and 0xC000 (I think) for color. However, I tried it, it wasn't pretty. I may have done it wrong though.

It could be done with an old compiler, (any 16 bit compiler or DOS 32 bit compiler), or even look for a copy of PowerBASIC. But, that's not what the OP is asking for :D .

Share this post


Link to post
Share on other sites
Quote:
Original post by Tarkus
I was actually wondering the same thing as the original poster... What I think he means is, is there someway to clear the screen, much like the BASIC command 'CLS'.


Not portably. Some people advocate system("cls"); -- it is an aberration.

arm has already posted the correct solution for MS Windows console applications.

Quote:
I know of an old trick where you could write directly to the video memory at 0x800 for monochrome and 0xC000 (I think) for color. However, I tried it, it wasn't pretty. I may have done it wrong though.


You can't do that in protected mode. That era is dead and buried. Use the API calls that have been mentioned.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!