http://img393.imageshack.us/img393/4944/untitled5tb.jpg
please help thanks
private ACEIDev ACEMouse; public ACEMou(Control ff){ ACEMouse = new ACEIDev(SystemGuid.Mouse);ACEMouse.Properties.AxisModeAbsolute = true;ACEMouse.SetCooperativeLevel(ff, CooperativeLevelFlags.Foreground | CooperativeLevelFlags.Exclusive); ACEMouse.Acquire(); } public Vector3 ACEMouseGetPos(){ MouseState ACEState = ACEMouse.CurrentMouseState; ACEMouseX=ACEState.X; ACEMouseY = ACEState.Y; ACEMouseZ = ACEState.Z; return new Vector3(ACEState.X,ACEState.Y,ACEState.Z);} |

Mouse input
FredP
if mouse aint moving x and y will be zero
X = left / right movement
Y = up / down movement
Z = scroll (returns 120 / -120 when scrolling)
...
this code shows the mouse coordinates in the titlebar
i added the sleep method, cause when running this test i dint render ... so mouse value changes were not visible.
long
__stdcall CTestApp::ProcessInput(ICREKeyboard *pKeyboard, ICREMouse *pMouse, ICREJoystick *pJoystick){
WCHAR lpMouse[MAX_PATH];
"X: %d | Y: %d | Z: %d", pMouse->GetAxis(CREMA_X), pMouse->GetAxis(CREMA_Y), pMouse->GetAxis(CREMA_SCROLL));wsprintf(lpMouse, L
SetWindowText(g_pState->GetWindow(), lpMouse);
Sleep(100);
return S_OK;
}
Gurpreet GIll
AlchemistMatt
Have you checked the following:
1) You're definitely getting mouse coordinates
2) Your formatting matches the type of the input
GatorBait58
I am not 100% sure but I think those values are stored up in the device. So over the life time of that device you have moved (-723952105x, 471007952y,0z). Everytime you move the mouse the change is added to this value.
I personally use Relative Axis Mode. This gives the change in mouse position since last check. I build a class on top that originally places the mouse at center screen, the just add the change to my stored mouse position and voila you have on screen coordinates for you mouse.
Andrew
Archimedez
If this is all your code, then the problem might be in the ACEIDev class
u might wanna put some breaklines on following lines ...
ACEMouseX=ACEState.X;
ACEMouseY = ACEState.Y;
ACEMouseZ = ACEState.Z;
and see the ACEState.X returns the same value to ACEMouseX like u have in your output ...
I have done direct mouse few days ago for my project and just ran some test ... it works fine on both win32 and win64.
// Store the cooperative level
m_lCooperativeLevel = 0L;
if(bForeground) { m_lCooperativeLevel = DISCL_FOREGROUND; } else { m_lCooperativeLevel = DISCL_BACKGROUND; }
if(bExclusive) { m_lCooperativeLevel |= DISCL_EXCLUSIVE; } else { m_lCooperativeLevel |= DISCL_NONEXCLUSIVE; }
// Initialize the microsoft direct input device interface
V_RETURN(pDirectInput->CreateDevice(GUID_SysMouse, &m_pDirectInputDevice, NULL));
V_RETURN(m_pDirectInputDevice->SetDataFormat(&c_dfDIMouse2));
V_RETURN(m_pDirectInputDevice->SetCooperativeLevel(hWnd, m_lCooperativeLevel));
// Acquire the microsoft direct input device
V_RETURN(m_pDirectInputDevice->Acquire()); ...
DIMOUSESTATE2 pMouseState;
sizeof(DIMOUSESTATE2));ZeroMemory(&pMouseState,
if(FAILED(hr = m_pDirectInputDevice->GetDeviceState(sizeof(DIMOUSESTATE2), &pMouseState)))
{ ... reacquire }
m_lAxis[CREMA_X] = pMouseState.lX;
m_lAxis[CREMA_Y] = pMouseState.lY;
m_lAxis[CREMA_SCROLL] = pMouseState.lZ;
BahKoo51
could you break that down
thts all my code above