How do I cage the mouse within a window?

Posted By: JakeL

How do I cage the mouse within a window? - 06/08/09 18:06

Is there an easy way to keep the mouse curser inside the engine window while in windowed mode? I'm sure this has been done before because it seems like something that people would need.

Is there a .dll out there or some API function that makes this easy? Something I missed in the manual?

Sorry if this is out there already. I spent a couple hours looking. Maybe I just don't know the correct terminology.
Posted By: Quad

Re: How do I cage the mouse within a window? - 06/08/09 18:25

you can do it without need of a dll,

include windows.h and use

SetCursorPos(x,y);
more info: http://msdn.microsoft.com/en-us/library/ms648394(VS.85).aspx

clamp x and y variables, and set mouse pos according to this variables in a loop.
Posted By: JakeL

Re: How do I cage the mouse within a window? - 06/08/09 18:32

Thanks Quadraxas! That is exactly what I needed.
Posted By: Carlos3DGS

windows mouse position - 06/10/09 23:16

hey that was very helpfull, just what I was looking for also.
Do you also know how to hide/show the windows mouse easily and change the windows cursor icon?
Posted By: Cowabanga

Re: windows mouse position - 06/11/09 05:07

By using "mouse_mode" and "mouse_map".
Posted By: Carlos3DGS

Re: windows mouse position - 06/11/09 14:11

I dont mean the engine's cursor, I mean changing window's cursor.
© 2024 lite-C Forums