You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add Renderer.logical_to_window and Renderer.window_to_logical from SDL2 (#3519)
* Add logical_to_window and window_to_logical from SDL2
See https://wiki.libsdl.org/SDL2/SDL_RenderLogicalToWindow and
https://wiki.libsdl.org/SDL2/SDL_RenderWindowToLogical
When setting renderer.logical_size, these two functions offer
translation between window space and logical space.
* Stubs added, return type of window_to_logical fixed
* Fix devcheck by running `dev.py format`
* Fix MS build that as warnings -> errors
* Try to fix stubs...
* tuple instead of *args, SDL3 migration guide follow
Both functions now expect a tuple, following the pygame conventions.
For SDL3, the ported functions have been renamed and changed.
> SDL_RenderWindowToLogical() and SDL_RenderLogicalToWindow() have been
> renamed SDL_RenderCoordinatesFromWindow() and
> SDL_RenderCoordinatesToWindow() and take floating point coordinates in
> both directions.
I settled on the following decisions
* Regardless of the difference in the windows coordinates being ints in
the old, and floats in the new version, I just aliased the new names
to the old functions on the python side.
* Even on SDL3, the window coordinates will be truncated to int to
guarantee future compatibility with old code.
* Accept and return floats everywhere, sdl3 aliases removed
* double, not float!
* Wording of error messages follows review suggestion
* modified test according to review
* dev.py format
* logical_to_window and window_to_logical for _sdl2.video
* versionadded added
* Moved to SDL3 function names as discussed
0 commit comments