I have been using the following for cocos SVG sprites:
class SVGNode(cocos.cocosnode.CocosNode):
""" A CocosNode that displays an SVG image, using squirtle library """
def __init__(self, filename):
super(SVGNode, self).__init__()
file = pyglet.resource.file(filename)
self.image = squirtle.SVG(file = file, anchor_x = "center",
anchor_y = "center")
self.width, self.height = self.image.width, self.image.height
def draw(self):
glPushMatrix()
glEnable(GL_POINT_SMOOTH)
glEnable(GL_BLEND)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
(x, y), angle, scale = self.position, self.rotation, self.scale
self.image.draw(x = x, y = y, angle = angle, scale = scale)
glPopMatrix()
class SVGSprite(cocos.sprite.Sprite):
""" A subclass of cocos Sprite that will accept the name of an SVG image """
def __init__(self, filename):
node = SVGNode(filename)
image = pyglet.image.create(width = int(node.width), height =
int(node.height))
cocos.sprite.Sprite.__init__(self, image)
self.add(node)
I don't know whether the way I have used draw() is appropriate, but it
seems to work ok.
John
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---