Sign in to follow this  
lucky6969b

Can't acquire mouse after this setup

Recommended Posts

lucky6969b    1330
Hi there, Code snippet, [CODE] inline HWND system::create_window(const char* classname,WNDPROC callback) { const WNDCLASSEX wc={ sizeof(WNDCLASSEX), CS_HREDRAW|CS_VREDRAW|CS_OWNDC, callback, 0, 0, instance, 0, LoadCursor(0,IDC_ARROW), (HBRUSH)GetStockObject(BLACK_BRUSH), NULL, classname, 0}; const ATOM reg=RegisterClassEx(&wc); const DWORD style=WS_POPUP; const DWORD exstyle=WS_EX_APPWINDOW; const int width=800; const int height=600; const HWND win=CreateWindowEx( exstyle, classname, WINDOW_TITLE, style, 0, 0, width, height, 0, 0, instance, NULL); return win; } [/CODE] The point is I don't want to go to full screen, but instead acquiring the mouse while in windowed mode. Is this possible? Thanks Jack

Share this post


Link to post
Share on other sites
lucky6969b    1330
Quote:
Original post by Evil Steve
Yes, it's possible. However, Don't do that. DirectInput is just a terrible idea for keyboard or mouse input.


If this is the case, what other methods should I use to gain control of the mouse? you meant to use traditional win32 methods? :)
Thanks
Jack

Share this post


Link to post
Share on other sites
Evil Steve    2017
Quote:
Original post by lucky6969b
Quote:
Original post by Evil Steve
Yes, it's possible. However, Don't do that. DirectInput is just a terrible idea for keyboard or mouse input.


If this is the case, what other methods should I use to gain control of the mouse? you meant to use traditional win32 methods? :)
Thanks
Jack
Yep, WM_MOUSEMOVE. If you really need high-DPI mouse input (For e.g. a FPS camera - and you don't need mouse coordinates in pixels), then you should use raw input (WM_INPUT).

Share this post


Link to post
Share on other sites
lucky6969b    1330
Steve,
Thank you for your suggestions.
And also how do you translate screen coords to Direct3D coords?
I have seen a few threads which inform to use a ray. What is the story about?

Have a nice day
Jack

Share this post


Link to post
Share on other sites
Evil Steve    2017
Quote:
Original post by lucky6969b
Steve,
Thank you for your suggestions.
And also how do you translate screen coords to Direct3D coords?
I have seen a few threads which inform to use a ray. What is the story about?

Have a nice day
Jack
Yup - it's called "picking" (Google will give loads of results). Link. Basically, you create a ray from the pixel (Since the world is 3D and the screen is 2D, one pixel represents a line in 3D space, which is this ray), and then see what intersects that line.

Share this post


Link to post
Share on other sites
lucky6969b    1330
What if I want to pick an empty point in space which is not being occupied by the Mesh or any other objects? Seems very unrealistic.... and doesn't make much sense!!
Actually now I am reading the Direct3D sample source code from the SDK?
Just want to know what MS has to say about picking? :)

Thanks
Jack

[Edited by - lucky6969b on May 14, 2008 5:35:46 AM]

Share this post


Link to post
Share on other sites
Evil Steve    2017
Quote:
Original post by lucky6969b
What if I want to pick an empty point in space which is not being occupied by the Mesh or any other objects? Seems very unrealistic.... and doesn't make much sense!!
Actually now I am reading the Direct3D sample source code from the SDK?
Just want to know what MS has to say about picking? :)
Picking isn't a D3D specific feature, it's generic to 3D graphics. I don't know if the SDK has anything about picking in it.
If you just want to pick an empty point, then you just need a ray and you can skip the second half.

There's no way to get a single 3D point given a 2D point though, there's not enough information there.

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