pygame-ce
pygame-ce copied to clipboard
Compile _sdl2.controller and _sdl2.touch with SDL3
trafficstars
I have started working on compiling pygame._sdl2 with SDL3. This PR is draft because I'd like to port touch and audio, I'm creating it early to get feedback and opinions, especially for the following submodules:
- We don't have to port video, right? I mean, it's being ported as pygame.render which hopefully is already sdl3 compatible. No reason porting obsolete code to SDL3
- Same thing for window. pygame.window is already ported, there's not reason to port this too, since it's also outdated. Do you agree? (also I want to see what the checks have to say about my changes)
EDIT: I compiled and ported controller and touch. I have made small edits to prepare audio, which I will do in the next PR, so this one is easier to approve.
Summary by CodeRabbit
-
New Features
- Broad SDL3 compatibility for gamepad, touch, and header integration; re-exports SDL version info via pygame._sdl2.
-
Bug Fixes
- Improved error handling, bounds checking, and clearer exceptions for device/finger access.
- Tighter memory management when querying devices/fingers.
- More explicit success/failure signaling for rumble and LED controls.
-
Chores
- Build and meson changes to conditionally include legacy SDL2 modules and always build core _sdl2; audio/video imports skipped on SDL3.