lordmauve / wasabi2d

Cutting-edge 2D game framework for Python
https://wasabi2d.readthedocs.io/
GNU Lesser General Public License v3.0
156 stars 24 forks source link

Add set_grab() function #20

Open lordmauve opened 4 years ago

lordmauve commented 4 years ago

Pygame has a method pygame.event.set_grab() which grabs exclusive use of the input.

We could wrap wrap this but also ensure Escape (or something) releases the exclusivity, and show a message on a custom layer to explain how to exit (like how full screen works in a browser).

larryhastings commented 4 years ago

Personally I would give it a better name. In a sea of mouse.* functions in the docs, searching for the word "grab" never occurred to me.

On a recent project, I found set_grab() literally by figuring out the Windows / Cocoa functions for mouse-window exclusivity, then grepping the SDL sources to see who called those, then grepping the PyGame sources to see who called the relevant bits of SDL.