[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Pygame for SDL 2, and how it may look.



​Hi,

I dug around in the SDL 2 source (mostly "src/render/*"). As I suspected, for hardware renderers, a renderer is essentially a graphics context. This means that:

1: A renderer is more-or-less decoupled from a window. Each window can be bound to up to one renderer, and each renderer can be bound to up to one window.
2: There can be many renderers and many windows.

On Thu, Apr 20, 2017 at 12:30 AM, Greg Ewing <greg.ewing@xxxxxxxxxxxxxxxx> wrote:
If that's true, then it might make sense for the Renderer to have
a 'window' attribute. The Renderer would then be the thing you
keep a long-term reference to, and you would obtain the Window
from it when needed.

​I like this idea a lot, modulo that you should also store the reference to the window.

If draws are done through the renderer, then to change the window, you need to change the renderer's pointer. This makes the problem I described a few days ago less hidden to the user. Exposing things in this way feels somehow "right" to me.

Ian