Sign in to follow this  
jagguy2

mouse move

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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);

}

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this