Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.

Real World

Mouse clicking problem...

This topic is 5855 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''m using Direct Input 8 to check the mouse for left clicks in my game for the purpose of navigating through a selection of menu screens. The problem I''m having is that when one button is clicked and the screen loads the next option menu, the button below that gets clicked too as the input is checked again and the mouse is still registered as being pressed. Is there a good way to reset the state of the mouse after each check so this doesnt happen? Cheers Dave
		// Make sure the mouse has been initialized
		if( !m_bInitialized )
			return FALSE;

		// Get the state of the mouse into the key buffer
		r = m_pMouse->GetDeviceState( sizeof(DIMOUSESTATE2), &m_dims2 );
		if( FAILED( r ) )
			// If the device is not acquired...
				// ...then reacquire the device
					r = m_pMouse->Acquire();

				if( SUCCEEDED( r ) )
					m_pMouse->GetDeviceState( sizeof(DIMOUSESTATE2), &m_dims2 );
					return FALSE;
				// ...Otherwise it was some other error
				return FALSE;

		// Check if the mouse was clicked
		if( key & 0x80 )
			return TRUE;
			return FALSE;
sorry for the double post :\

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!