1

Hi so i'm making a game through the console window, and i was wondering if there was any way to just get maybe one or two text character's placement to change or disappear. Usually to accomplish this i would have to tell the console to re-type every single character and line all over again, but this just takes to long (1 second fps plus .5 second time spent re-typing the scene).

Is there some way i could re-fresh or change one or two lines or 'characters' seen on the console so so much time is not spent on waiting for the console to re-typing my 24 lines, each a string? (the scene made up of text)

Thanks! =)

btw... does anyone remember that little easter egg in windows which was an entire star wars movie made out of text in the console?? I want the game be smooth like that!

Griffin
  • 2,399
  • 7
  • 48
  • 83

2 Answers2

3

You need ncurses library. See console print w/o scrolling for reasons and examples.

Also google for the source to the rogue/urogue/nethack games which do that already.

Community
  • 1
  • 1
Magicianeer
  • 2,190
  • 1
  • 15
  • 12
3

You'll need to use an external library to interface with the console as C++ doesn't have these capabilities, but it is possible.

My old goto for this sort of thing is ncurses. It's straightforward, quick to set up, and cross-platform. But it's old, and its age shows. (If you're on windows you'll have to use pdcurses; same capabilities, different package).

There are also console-specific ways of doing this. In particular, Windows provides an API for performing these sorts of actions.

Zilchonum
  • 681
  • 1
  • 5
  • 9