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
Whats wrong with my Direct Input/Mouse?
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.
if( MouseState[ MouseState.rgbButtons[1] ] & 0x80 ){
// Yup!
}else{
// Nope
}
Does it work???
.lick
[edited by - Pipo DeClown on September 3, 2003 10:05:40 AM]
// Yup!
}else{
// Nope
}
Does it work???
.lick
[edited by - Pipo DeClown on September 3, 2003 10:05:40 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement