Locking mouse to game window

Airblade locks the mouse to the game window but I cannot figure out how they are doing it. I am looking at their mouse controls and I tried that and it doesn’t work. How can I prevent the mouse from leaving the game window? This is really important as the frantic mouse movements in the game make it very likely to click outside.

Airblade doesn’t do anything to lock the mouse. It uses the standard movePointer, nothing special. If you doubt it, open your MouseControls.py, comment out this line : “prop.setCursorHidden(True)” and you’ll see how it get repositioned every frame. If you move your mouse very fast, it would jump off the window too. If it’s harder to jump off than in your own application, it may caused by the different framerate, Airblade must be lighter than your application.