mouse move

Started by
3 comments, last by jagguy2 16 years, 3 months ago
q)i want to move my mouse with my directx/c++ program. How can i detect mouse movements so i can move the camera? i have to move the camera not only left or right but up and down . q) how can i click on an object with a mouse and get the 3d coordinates?
Advertisement
Quote:Original post by jagguy2
q)i want to move my mouse with my directx/c++ program. How can i detect mouse movements so i can move the camera?

i have to move the camera not only left or right but up and down.
WM_MOUSEMOVE, or raw input if you really need high resolution mouse input. Don't use DirectInput for it.

Quote:Original post by jagguy2
q) how can i click on an object with a mouse and get the 3d coordinates?
Google for "picking", or look at the "Pick" sample in the SDK.
ok can i simply detect mouse movement like a key input?

go celtic!!!!
Quote:Original post by jagguy2
ok can i simply detect mouse movement like a key input?
Yup. Your window gets sent WM_MOUSEMOVE messages, which contain the current position of the mouse pointer (in client coordinates). You might want to use SetCapture() to capture mouse input when it's not in your client area, depending on what you're doing.
I used this code for a left key mouse

q) is this the best way to test key input? isnt there a directx way?


if (GetAsyncKeyState(VK_LBUTTON))
{

GetCursorPos(&pt);
ScreenToClient(hWnd, &pt);

}

This topic is closed to new replies.

Advertisement