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

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



Lenard Lindstrom wrote:
Extension type WindowSurface would add an SDL window C pointer to its pygame.Surface parent. This window pointer cannot be factored out into a separate WindowBase parent class. And any methods which access that pointer will be specific to WindowSurface's C structure type.

And consequently, it would be impossible to write code that
generically works with either type of window at the C level
without going through Python method or property dispatch.

* Cython has an include statement. Unfortunately, include statements are not allowed in class declarations.

Even if it worked, the effect would be no different from
writing out a copy of the code in each class. You would still
have two unrelated sets of fields with different offsets.

Splitting it into two objects sounds like the best solution
to me. Then you can have a Window object with the same interface
whether it has a Renderer or a Surface attached, and a Renderer
with the same interface whether it's attached to a Window
or something else.

--
Greg