if (keyPressed[VK_UP])
ballY += 0.01f;
if (keyPressed[VK_DOWN])
ballY -= 0.01f;
if (keyPressed[VK_RIGHT])
ballX += 0.01f;
if (keyPressed[VK_LEFT])
ballX -= 0.01f;
if (keyPressed['A'])
ballZ += 0.01f;
if (keyPressed['Z'])
ballZ -= 0.01f;
strange crash with input
I am using NeHe's tutorial 26 (reflection of a ball onto a plane), I have everything working well apart from the input. I have the folloing code:
I have found out that it will only accept the first two if (so it will only accept up/down arrows, but if that is commented out then it will only accept right/left arrows), and only then if none of the other keys have been pressed.
So if I press the right arrow when the program loads no input will be taken at all, not even Esc to quit. However if I just use the up/down arrows then I can use Esc to quit normally.
What am I doing wrong here?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement