Skip to main content
gamedev.net
🔒 Locked

Direct Input Question

Started by HellRaiZer May 13, 2003 at 4:05 AM 0 replies 300+ views
Original Post
HellRaiZer
HellRaiZer
I have a question about the code below. To Initialize direct input for mouse i do: DirectInput8Create(hInstanceWMain, DIRECTINPUT_VERSION,IID_IDirectInput8, (void**)&pDirectInput, NULL))); pDirectInput->CreateDevice(GUID_SysMouse,&pMouse,NULL)); pMouse->SetDataFormat(&c_dfDIMouse)); SetCooperativeLevel(hWndDIMouse,DISCL_FOREGROUND | DISCL_NONEXCLUSIVE)); pMouse->Acquire(); And the Code For the mouse is: bool cHOEProcess::MouseProcess() { DIMOUSESTATE MouseState; if(FAILED(DirectInput.pMouse->GetDeviceState(sizeof(MouseState),(LPVOID)&MouseState))) { DirectInput.pMouse->Acquire(); if(FAILED(DirectInput.pMouse->GetDeviceState(sizeof(MouseState),(LPVOID)&MouseState))) { LogFile.WriteErrorFile("Get Device State (Mouse)"); return false; } } POINT pMouse; GetCursorPos(&pMouse); int MiddleX = GLWindow->Width /2; int MiddleY = GLWindow->Height/2; float AngleX = 0.0f, AngleY = 0.0f; if(pMouse.x == MiddleX && pMouse.y == MiddleY) { return true; } SetCursorPos(MiddleX,MiddleY); AngleX += MouseState.lX; AngleY += MouseState.lY; Camera.CameraView.y += -AngleY*4/1000; Camera.CameraRotate(AngleX/1000); return true; } The question is simple. Is this Direct input??? If not how can i set the mouse cursor in the middle of the screen without the SetCursorPos() func. How you guys do it? Please Answer.!!! Thanks in Advance.
HellRaiZer

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.