Hi guys,
I searched on this forum for posts concerning my problem but I didn't find any so I' opening a new thread.
First of all a little bit code.
// Create the DI object
DirectInput8Create(lpmEngine->hInstance, DIRECTINPUT_VERSION, IID_IDirectInput8, (VOID**)&lpDI, NULL);
HRESULT hr;
hr = lpDI->CreateDevice(GUID_SysMouse,&lpMouse,NULL);
hr = lpMouse->SetDataFormat(&c_dfDIMouse2);
hr = lpMouse->SetCooperativeLevel(lpmEngine->hWnd, DISCL_BACKGROUND | DISCL_NONEXCLUSIVE);
hr = lpMouse->Acquire();
// Mouse Pos
POINT pt;
GetCursorPos(&pt);
if(lpmEngine->bWindowed)
ScreenToClient(lpmEngine->hWnd,&pt);
MouseX = pt.x;
MouseY = pt.y;
That's the Init Code.
Then, every frame:
DIMOUSESTATE2 MouseState;
relMouseX = 0;
relMouseY = 0;
// Eingabedaten von der Maus holen
if(lpMouse->GetDeviceState(sizeof(DIMOUSESTATE2), &MouseState) == DIERR_INPUTLOST)
{
// Maus neu reservieren und nochmal versuchen
if(lpMouse->Acquire()==DI_OK)
lpMouse->GetDeviceState(sizeof(DIMOUSESTATE2), &MouseState);
}
MouseX +=MouseState.lX;
relMouseX = MouseState.lX;
MouseY +=MouseState.lY;
relMouseY = MouseState.lY;
POINT pt = {MouseX,MouseY};
if(lpmEngine->bWindowed)
ClientToScreen(lpmEngine->hWnd,&pt);
if(pt.x<0)
pt.x = 0;
else if(pt.x > lpmEngine->ScreenWidth)
pt.x = lpmEngine->ScreenWidth;
if(pt.y<0)
pt.y = 0;
else if(pt.y > lpmEngine->ScreenHeight)
pt.y = lpmEngine->ScreenHeight;
if(lpmEngine->bWindowed)
ScreenToClient(lpmEngine->hWnd,&pt);
MouseX = pt.x;
MouseY = pt.y;
That's the whole code infecting the mouse coordinates.
It works great on my computer (WIN XP, DX 9.0b, MS Intelli Explorer 3.0 ) I'm using Visual Studio .net to compile the code.
I have two friend and I gave them my app to test. The first one has a Win98 system, the second one a WIN XP system.
When I point to the ClientPixelOrigin, the X and Y coordinates are 0. But on my friend's computer they are different every time. When they move their mouse fast over the whole screen and point to the same point, the coordinate is different. I tried it already with buffered data -> same thing.
I would be really content if someone can help me!
Thanks
verTex
[edited by - ver_T_ex on March 7, 2004 2:14:54 PM]