Thomas, I believe there are character input functions in the standard C library, at least on Mac OS X. Look into getchar() and other variants which take streams other than standard input. THis isn’t a C++-specific mechanism, but should still work if you’re just doing console IO. I have manual pages for getchar on my mac. These are prototyped in stdio.h in C, but I believe there’s a way to use them in C++ too. I disagree with your dislike of IF-specific languages, but that’s a topic for another day. Hope this helps a bit. For the record, your approach seems fine too. Best, Zack.
On Apr 15, 2014, at 8:32 PM, Thomas Ward <[email protected]> wrote: > Hi all, > > This question is mostly for developer's but any thoughts from > non-developers are welcome as well. > > At the moment I am working on a quick and dirty text adventure system > written in C++ suitable for developing classic interactive fiction > games similar to games like the Infocom text adventures like Zork, > Arthur, Hitch Hikers Guide to the Galaxy, and so forth. Since I am not > really a fan of the text adventure languages like Inform and AGT I > have decided to create my own system in C++, but have run into a > slight problem with the text adventure system. > > In Dos/Windows if one wants to pause a screen of text all he or she > has to do is call the _getch() function which will pause the out put > until the enter or space key is pressed. Mac OSX and Linux have no > such function and similar functionality has to be accessed through > ncurses or another library like that. I am trying to come up with a > pause function that will be completely cross-platform and will compile > on any platform without having to involve ncurses or some other > third-party solution. So what I have done in the meantime is use the > standard cin input stream with a prompt that says, "press c to > continue or q to quit." I am wondering if people are okay with this > method of pausing the screen, or if some of you developers knows of a > better way to go about pausing the text on screen let me know. > > Thanks. > > --- > Gamers mailing list __ [email protected] > If you want to leave the list, send E-mail to [email protected]. > You can make changes or update your subscription via the web, at > http://audyssey.org/mailman/listinfo/gamers_audyssey.org. > All messages are archived and can be searched and read at > http://www.mail-archive.com/[email protected]. > If you have any questions or concerns regarding the management of the list, > please send E-mail to [email protected]. --- Gamers mailing list __ [email protected] If you want to leave the list, send E-mail to [email protected]. You can make changes or update your subscription via the web, at http://audyssey.org/mailman/listinfo/gamers_audyssey.org. All messages are archived and can be searched and read at http://www.mail-archive.com/[email protected]. If you have any questions or concerns regarding the management of the list, please send E-mail to [email protected].
