currently i'm developing my game in window mode, but the mouse go out of the window, and controll the camera is a mess crazy

any way to capture and keep the mouse, and in case to release it when i need it ? confused