Is it possible to combine the renderer with the window? I don't see why the renderer needs to be pulled out of the pygame.draw module, and indeed, this could be confusing for existing code.I don't quite understand. The renderer associated with the RendererWindow instance is returned by the window's renderer property.
Why are the window and the renderer separate objects? There is a one-to-one relation between a window and its renderer or a display surface. And a window cannot have both. To avoid duplicating a bunch of window specific methods I created a Window class, with RendererWindow and SurfaceWindow (not shown) as subclasses. Also, a surface can have a renderer, and a combined surface-renderer object makes no sense. Still, I haven't ruled out renderer-window and surface-window types yet. However it is done, I don't see an elegant representation of the relationships among SDL windows, surfaces, renders, and textures.
For maximum backcompatibility, something like the following would seem to fit better with the existing API:The user can choose either a renderer or a display surface for a window. And pixels can be copied between textures and surfaces. So hardware accelerated rendering is available, as shown in the example.
surf1 = pygame.display.Window(rect1,flags)
surf2 = pygame.display.Window(rect2,flags)
#...
surf1.blit(...)
surf2.blit(...)
#...
pygame.display.flip()
I don't recall what was decided about the feasibility of implementing SDL2-style or hardware-accelerated rendering, but I'd hazard that this sort of API wouldn't map well to it. OTOH, I don't think the decision to implement a modern graphics interface was decided in the first place (just that we're currently adding some SDL2 stuff).
As for set_mode(), flip(), and update(), they remain in Pygame SDL 2. Keeping as much of the Pygame SDL 1 API in Pygame SDL 2 is a priority. This example explores how new SDL 2 specific capabilities can be added to Pygame. It uses a Python feature unavailable when Pygame was created, the new-style class.
It's worth noting that switching the graphics context between windows (to do hardware draws) isn't free, and simple code (that e.g. draws a bunch of things on two windows, switching every draw call for code clarity) might not run very well. Perhaps the API should discourage this somehow, especially if full HW drawing is encouraged.
Again I don't understand. Given a window, its renderer, and a bunch of textures: render the textures to various locations on the window, update (expose) the renderer, then repeat. How is this not hardware drawing. What am I missing?
Lenard Lindstrom