Original Post
I am writing a DInput Wrapper Class that included a functions
that the mouse can return the absolute coordinate (X and Y),
so what did i do is just Set the axis mode of the mousedevice
to Absolute and then reacquire it again, and after GetDeviceState I found that the mouseState coordiante reterieved is not an absolute coordinate, it was some random number, so is there any method to retrieve the absolute coordinate according to the screen resolution?
e.g. the centre point of a 1024*768 screen is (512,384)
Thanks for your attention!! :>
// Set the Axis to Absolute Mode
DIPROPDWORD dipdw;
dipdw.diph.dwSize = sizeof(DIPROPDWORD);
dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER);
dipdw.diph.dwObj = 0;
dipdw.diph.dwHow = DIPH_DEVICE;
dipdw.dwData = DIPROPAXISMODE_ABS;
m_pDirectInputMouseDevice->SetProperty(DIPROP_AXISMODE, &dipdw.diph);
// Acquire the mouse device
m_pDirectInputMouseDevice->Acquire();
// update the current device states, if DIERR_INPUTLOST returned, acquire again
if(m_pDirectInputMouseDevice->GetDeviceState(sizeof(m_MouseState),(LPVOID)&m_MouseState) == DIERR_INPUTLOST)
{
m_pDirectInputMouseDevice->Acquire();
}
// m_MouseState.lX = Absolute X Coordinate?
// m_MouseState.lY = Absolute Y Coordinate?