异步Windows控制台输入,同时输出 [英] Asynchronous Windows Console input whilst outputting
问题描述
长时间阅读,第一次海报:D
Long time reader, first time poster :D
我在同时输出时试图读取输入的问题。我需要一个服务器控制台为我的游戏,可以接收输入,而不是搞乱缓冲区。
I'm having issues trying to read input whilst outputting at the same time. I need a server console for my game which can receive input whilst outputting and not mess up the buffer.
例如,我在输入Hello world过程,玩家死亡,杀死等都输出到控制台,这将导致类似:
For example, I'm typing "Hello world" and in the process, player deaths, kills, etc. are being outputted into the console, which would result in something like:
Hello Player killed Player2world
推荐答案
方案
为什么不产生一个GUI窗口,而不是直接写输出到控制台?
Instead of writing output directly to the console, why not spawn a GUI window?
并在底部有一个单独的输入区域,您可以在其中键入命令。 Kinda喜欢irc客户端的外观。
Then, just have one area where output is directed, and a separate input area at the bottom where you can type commands. Kinda like how an irc client would look.
如果它只是控制台,我建议使用像ncurses(或PDCurses)来创建一个基于文本的界面。
If it has to be console only, I would suggest using something like ncurses (or PDCurses) to create a text based interface.
这篇关于异步Windows控制台输入,同时输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!