py-sdl / py-sdl2

Python ctypes wrapper around SDL2
Other
303 stars 49 forks source link

Add new sdl2.ext module for handling SDL input events #261

Closed a-hurst closed 1 year ago

a-hurst commented 1 year ago

PR Description

This PR adds a new sdl2.ext module with a series of functions that allow Pythonic handling of SDL input events without needing to deal directly with SDL_Event loops, as well as an additional function in sdl2.ext.common for specifically handling quit requests. The current PR contains functions for handling keypress, mouse click, and text input events, but joystick/controller events will hopefully be added in a future update.

In general, these new functions should make it faster and easier for SDL2 beginners (and veterans) to write clean, readable input processing loops while also allowing a great deal of flexibility.

Merge Checklist