I'm trying to write a class that Inheritance from
sfml.TransformableDrawable, however, I don't have clear at all how to use the
draw method. However, I got a Segmentation Fault and an TypeError exception:
class Tile(sfml.TransformableDrawable):
def __init__(self, image):
sfml.TransformableDrawable.__init__(self)
if isinstance(image, sfml.Texture):
self.texture = image
else:
raise TATileImageException, ("Se esperaba un objeto del tipo "
"sfml.Texture"
" recibido {0}".format(type(image)))
def draw(self, target, states):
# states.transform = self.transform #<--- Segmentation Fault :@
states.texture = self.texture
target.draw(self.texture, states) #<--- TypeError: Argument 'drawable' has incorrect type (expected sfml.graphics.Drawable, got sfml.graphics.Texture)
Any help to make this class works?