Sign in to follow this  
lapskauz

Alternatives to the console?

Recommended Posts

Are there any good alternatives to the standard console for writing text based games in c++? I'd like to seperate the input from the output so to speak, so i can have my game running real time. The problem is that fetching commands using cin would make my game wait for the user to finish his input while nothing happens on screen. I'd like to have it working more like any irc program where you can type in text on the bottom while the window above scrolls independently. My hacky temporary solution is to just wait until the user hits a key with kbhit() before using cin, but even that is kinda lame as everything still freezes up while you're typing. So, any ideas?

Share this post


Link to post
Share on other sites
You could use only kbhit(), and then with getch() catch the pressed key. Keep the keys in a buffer until you detect an enter. Or however you want to handle it.

That way, you can retrieve whole words from the user, but still keep pumping your update loop. :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this