I've got a function here that manipulates some variables depending on what key is pressed: my problem is that this is called from a loop and the loop continues to run with this method if the user enters a key or not. I need a method that pauses the execution of the program until the user hits a valid key.
Code:void controlPlayer() { if ( GetAsyncKeyState ( VK_UP ) & SHRT_MAX ) --coY; else if ( GetAsyncKeyState ( VK_DOWN ) & SHRT_MAX ) ++coY; else if ( GetAsyncKeyState ( VK_LEFT ) & SHRT_MAX ) --coX; else if ( GetAsyncKeyState ( VK_RIGHT ) & SHRT_MAX ) ++coX; }