[C++] Creating a console version of worm

Started by
3 comments, last by SiCrane 16 years, 9 months ago
Here I go again, I recently saw a text-based version of worm running in UNIX shell. Frankly I was impressed, and out of sheer curiosity, would like to implement a similar version in C++. But research has indicated that there is a certain library called ncurses that might allow a programmer to implement text-based animation of said game. The only problem is there are few stable/incomplete ports of ncurses for Windows. So is there any method, library, or other way where I can re-create a fully functional version of worm on a text-based console? Thanks.
Advertisement
You could use pdcurses , but it's not that hard to use WriteConsoleOutput() (and related functions) to manipulate a console buffer yourself.
PDCurses is quite stable. I know a number of rogue likes have windows ports that use it (like Adom). It should do everything you need.
Thanks for the help, if I may though I have one more question. in making this text-based version of worm, I need to simulate animation. Currently I am experimenting with creating some functions to do this for me, while still leaving the option of pdcurses in mind.

My implementation of animation in the console window consists of using
system("cls"). I later found this technique to be very poor, as the animation was not smooth but very "flickery" and choppy. I guess because every time a frame would update, the whole screen would have to be recleared and everything redrawn.

My question is that before I switch to a library like pdcurses, are there any functions defined elsewhere that allow for smoother animation in the console window (or at least as to where only the needed parts of the screen are cleared while the rest of the buffer remains intact)? Thanks once again.
Quote:Original post by SiCrane
t's not that hard to use WriteConsoleOutput() (and related functions) to manipulate a console buffer yourself.


This topic is closed to new replies.

Advertisement