0

I am making a program on mac but I need a kbhit() equivalent and all the ones I see are too complicated, too long or I just can't use them in my code because I don't get it or I don't know how to add it in.

Please note I have curses.h included.

void Input(){
    if (kbhit()){
        switch (getch()){
            case 'a':
                dir = LEFT;
                break;
            case 's':
                dir = DOWN;
                break;
            case 'd':
                dir = RIGHT;
                break;
            case 'w':
                dir = UP;
                break;
            case 'x':
                gameOver = true;
                break;

        }
    }
}

Can you please help me figure this out?

Asra
  • 151
  • 1
  • 11

0 Answers0