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

Re: [pygame] Surface objects



On 14.07.2011 16:18, sam.hacking@xxxxxxxx wrote:
Hey guys,
 
I have a class which inherits from pygame.Surface. If the class gets created with a tuple, I create a new surface by calling pygame.Surface.__init__, so my class will work as a pygame.Surface object.
     I also need this class to be created with existing pygame.Surface objects. So, if I pass in a pygame.Surface object to my class, how can I get my class to be treated as a pygame.Surface object? Do pygame.Surface objects store their data in an accessible variable such as _image, in which case I presume I could copy the Surface._image to self._image to get the desired effect?
 
Thanks,
Sam Bull


Hi

An old experiment of mine, it might give you a clue how you can do it (actually it replaces the pygame Surface object with the SurfaceObject class):

https://python-pyknic.googlecode.com/svn/branches/pyknic-2.0/experimental/surfaceobject.py


Hope it helps.

~DR0ID