异步Windows控制台输入,同时输出 [英] Asynchronous Windows Console input whilst outputting

查看:476
本文介绍了异步Windows控制台输入,同时输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

长时间阅读,第一次海报: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:


* world

Hello *Player killed Player2*world

提前感谢

推荐答案

而不是直接写输出到控制台,为什么不产生一个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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆