Jump to content
  • Advertisement
Sign in to follow this  

glutjoystickfunc ?

This topic is 3714 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 my glutjoystickfunc doesnt seem to work how i want it only performs an action if a button or direction is hit and not held any ideas? i want the button to act as an accelerator so that when i hold it down the car continues to run forward but at the moment when i push it the car moves forward one space and for me to get it to continue to move forward i have to keep pushing the button repeatidly.

//does work if called with the keyboard function
void updateMatrix(char direction)
     if (direction == 'a') 
	heading = heading + 2;

//joystick function
void joystick(unsigned int buttons, int xaxis, int yaxis, int zaxis)
	char direction[7];

	if (xaxis < 0) direction[0] = 'a';

	if (xaxis > 0) direction[0] = 'd';

	if (buttons&0x0001) direction[2] = 's';
	if (buttons&0x0002) direction[2] = 'w';


//In main game loop

any ideas?

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!