Jump to content
  • Advertisement

Archived

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

johnnyBravo

Whats wrong with my Direct Input/Mouse?

This topic is 5403 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 trying to detect if the left mouse button is pressed. When i run the program it keeps detecting that the button is being pressed even though it isnt.

	class DIMouse {
	private:
		LPDIRECTINPUTDEVICE8 di_mouse;		
	public:
		LPDIRECTINPUT8 di_DI;
		LPDIRECTINPUTDEVICE8 di_device;
		void Init(HWND hWNd)
		{
			di_DI->CreateDevice(GUID_SysMouse, &di_mouse, NULL);
			di_mouse->SetDataFormat(&c_dfDIMouse);
			di_mouse->SetCooperativeLevel(hWNd, DISCL_EXCLUSIVE|DISCL_FOREGROUND);
			di_mouse->Acquire();
		}

		bool Button()
		{
			
			DIMOUSESTATE MouseState;
			di_mouse->GetDeviceState(sizeof(DIMOUSESTATE), (LPVOID)&MouseState);
			if (MouseState.rgbButtons[1]& 0x80)
				return true;
			else
				return false;
		}
	

	};
I can''t work out whats wrong from looking at the tutorials

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!