[英]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.