Continuous keyboard input in C

后端 未结 3 1502
猫巷女王i
猫巷女王i 2021-02-07 05:18

I am creating a console application in C. This is a game in which characters are falling down and user has to press that specific key on the keyboard. I don\'t know how to detec

3条回答
  •  遇见更好的自我
    2021-02-07 06:11

    You may probably look for ncurses

    ncurses (new curses) is a programming library that provides an API which allows the programmer to write text-based user interfaces in a terminal-independent manner. It is a toolkit for developing "GUI-like" application software that runs under a terminal emulator.

    Also check C/C++: Capture characters from standard input without waiting for enter to be pressed

    #include 
    
    if (kbhit()!=0) {
        cout<

提交回复
热议问题