Let's say you play a game on the computer, you move your character with arrow keys or WASD, if, let's say, you press and hold the up arrow key/W and left arrow key/A together, if the game allows it, your character will move somewhere in between, even if you press and hold one of the 2 first and the other later, while continue holding the first, none of the 2 will get interrupted and then ignored.
I know how to detect if the user pressed an arrow key/letter,
#include <iostream>
#include <conio.h>
using namespace std;
int main() {
while (1) {
int ch = getch();
if (ch == 224) {
ch = getch();
switch (ch) {
case 72: cout << "up\n"; break;
case 80: cout << "down\n"; break;
case 77: cout << "right\n"; break;
case 75: cout << "left\n"; break;
default: cout << "unknown\n";
}
}
else
cout << char(ch) << '\n';
}
}
but I can't find a way to do what I mentioned at the beginning of this question
Any attempt to help is appreciated