[英]I'm using _getch() in C++ and i want to know if it can detect the arrow keys instead of the other keys
如果你们想知道,它是一个控制台应用程序,我真的没有使用 WASD 的问题,但我不介意能够使用箭头键。
char _input = 0;
char _up = 'Z';
char _down = 'S';
char _left = 'Q';
char _right = 'D';
do
{
_input = _getch();
switch (_input)
{
case 'Z':
case 'z':
_input = _up;
break;
case 'Q':
case 'q':
_input = _left;
break;
case 'S':
case 's':
_input = _down;
break;
case 'D':
case 'd':
_input = _right;
break;
}
} while (_input == 0);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.