KeyboardInput - копия
KeyboardInput - копия
h"
#include <cstdio>
#include <termios.h>
#include <unistd.h>
#include <fcntl.h>
tcgetattr(STDIN_FILENO, &oldt);
newt = oldt;
newt.c_lflag &= ~(ICANON | ECHO);
tcsetattr(STDIN_FILENO, TCSANOW, &newt);
oldf = fcntl(STDIN_FILENO, F_GETFL, 0);
fcntl(STDIN_FILENO, F_SETFL, oldf | O_NONBLOCK);
ch = getchar();
return false;
}
KeyboardInput::Direction KeyboardInput::getDirection() {
bool up = isKeyPressed('w');
bool down = isKeyPressed('s');
bool left = isKeyPressed('a');
bool right = isKeyPressed('d');
return Direction::NONE;
}