I need help. I am making a game and it should work while ESC isn't pressed. The problem is how to do it. If I use getch(), it wait's for any key, but I don't . need it. It should work and work.
I am usin BorlandC++.
It shuld be like
While(getch()!=27)
but it will wait, which I don't need
You can use GetAsyncKeyState(VK_ESCAPE) from <windows.h>. GetAsyncKeyState checks the state of a key, without waiting for it. It returns true if the key is pressed, false if it isn't. The argument should be of type integer, VK_ESCAPE is a defined value in <windows.h>. For arrows and space you can use VK_UP, VK_SPACE etc. For normal keys you need to ASCII code of the capital. Eg, if you want something to happen when 'a' is pressed, you can use GetAsyncKeyState( (int) 'A' ).