我如何实施"多任务处理"在C ++中?
答案 0 :(得分:1)
对于终端中的Pong风格游戏,您需要使用ncurses
库。在那里,你可以写一个类似这样的游戏循环:
#include <curses.h>
while (true) {
int k = getch();
// Determine whether k is a keypress or not, and take action if so.
// Update game display
}
getch()
功能可以检查键盘输入而无需停下来等待它。