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

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





On 4/20/2017 8:13:22 AM, "Greg Ewing" <greg.ewing@xxxxxxxxxxxxxxxx> wrote:

Lenard Lindstrom wrote:
However, after a bit of experimenting I find a window can have both a renderer and a display surface.

In that case, I'd suggest the Window object should have
'renderer' and 'surface' attributes. If the Renderer or
Surface keeps a reference back to the window, it should
probably be a weak reference, so that they won't keep
each other alive.

You (not necessarily pointed towards Greg) definitely should dig deeper
into the SDL renderer API.

Renderers can be created for windows, surfaces (and window surfaces).
You can retrieve a renderer for a window (via SDL_GetRenderer()).

Avoid pythonic OO pitfalls, which will create a reference mess. Keep
both, renderers and windows separate and use dynamic properties
(if necessary) instead.

Personally, I'd leave it up to the user code instead of getting in the
way.

Cheers
Marcus