Jump to content
  • Advertisement
Sign in to follow this  
orcfan32

Refreshing a...console?

This topic is 4814 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

Well, time to reveal what I've been planning: CONSOLE TETRIS!! Problem is, I don't want to keep printing more text! I wan't to remove old text and replace with new text. Possible? Not possible?

Share this post


Link to post
Share on other sites
Advertisement
Assuming Windows, you can write directly to coordinates in the console using the WriteConsoleOutput() family of functions. In *nix, you can use a curses library like ncurses.

Share this post


Link to post
Share on other sites
Quote:
Original post by SiCrane
In *nix, you can use a curses library like ncurses.

And there's also pdcurses which is cross platform.

Share this post


Link to post
Share on other sites
Quote:
Original post by orcfan32
Quote:
Original post by Gink
Use system("CLS");


Exactly what I needed, thanks.


But I don't think this way is very effective. It calls an external program where it executes a command to clear the screen. It might make your game slow at updating itself. You could try the second approach listed here, http://support.microsoft.com/default.aspx?scid=kb;en-us;99261, which should make you program more effective.

Edit: How to I create clickable URL's?

Share this post


Link to post
Share on other sites
Quote:
Original post by orcfan32
Well, nevermind clearing the entire screen. How would I clear a certain line??


In Tetris, when you need to do this (or something like it), you'll have to move stuff down into the space anyway. What you want to do is maintain a buffer inside your program that describes the current "appearance" of the game, and periodically redraw that to screen. As blocks fall/lines form/etc., update the buffer by copying/clearing/resetting data within it.

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!