Jump to content
  • Advertisement
Sign in to follow this  

strange crash with input

This topic is 5408 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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:
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;

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?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!