I'm programming a console game, (pac-man), and I was wondering how I would get user input without them pressing the enter key. I looked around the internet a little and I found some stuff about _getch()
but it is apparently no longer current and no header files are known to declare it unless one builds his own which I cannot do as I'm still really new to C++.
So how would I build a code that can do this?
Thanks
相关问题
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
- What uses more memory in c++? An 2 ints or 2 funct
相关文章
- 放在input的text下文本一直出现一个/(即使还没输入任何值)是什么情况
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
- What exactly do pointers store? (C++)
- Converting glm::lookat matrix to quaternion and ba
you can use conio.h library and a function _getch() to get input in a live fashion and you can also set loop for multiple inputs.
This works for me (I am on linux):
It makes the console unbuffered.
reference: http://shtrom.ssji.net/skb/getc.html