Original Post
Hi,
I''m making a windowed game and I set the mouse cursor to the lower left portion of my playing surface and set a mousex and mousey position variable to zero.
Now I initialized like so:
if(FAILED(lpdi->CreateDevice(GUID_SysMouse, &lpdimouse, NULL)))
return(0);
if(FAILED(lpdimouse->SetCooperativeLevel(main_window_handle, DISCL_BACKGROUND| DISCL_NONEXCLUSIVE)))
return(0);
if(FAILED(lpdimouse->SetDataFormat(&c_dfDIMouse)))
return(0);
if(FAILED(lpdimouse->Acquire()))
return(0);
then at each call of my game loop I do the following
if(FAILED(lpdimouse->GetDeviceState(sizeof(DIMOUSESTATE), (LPVOID)&mousestate)))
return(0);
mouse_posx += mousestate.lX;
mouse_posy += mousestate.lY;
if(mouse_posx > 400)
test
where test is defined as a MessageBox just to notify me when this happens
My problem is that since my playing surface is 400 pixels wide and it starts at the first pixel in the surface, being 0x. Why is it that the message box comes up way before 400. And sometimes if I move the mouse around frantically. The position in which it calls the box changes? This has stumped me.