On 4/3/08, pwrx <[EMAIL PROTECTED]> wrote:
>
>  What is the pyglet "way" to do nested sprites? Sprites that have their
>  origin/orientation/scale defined by a parent sprite? (a turret on a
>  tank. orbs circling a wizard. fancy text with letters that can
>  zoom,spin and fade independently but still line up correctly)
>
>  In the pre-pyglet version of my code I did something like this:
>  Class Sprite:
>  def old_style_draw(self):
>   glPushMatrix
>   glTranslate
>   glRotate
>   glScale
>   self.texture.draw()
>   for child in self.children:
>     child.old_style_draw()
>   glPopMatrix
>
>  In the pyglet.sprite world my sprites are out of the draw loop! Pyglet
>  only loves them for their vertices.
>
>  My only idea is to use a ChildGroup:
>  class ChildGroup(pyglet.graphics.Group):
>  def __init__(self,parent_sprite):
>   ...
>  def set_state(self):
>   glPushMatrix
>   glTranslate(self.parent_sprite.x....)
>   ...
>
>  def unset_state(self):
>   glPopMatrix
>
>  And this idea seems appealing to me except that as far as I can tell
>  Batches never release any group once its added to them. I use nested
>  sprites a lot in my special effects. They come and go a lot.
>
>  Is there a natural way to do what I want to do with pyglet sprites? Is
>  there a better way to think about my problem? Should there be a
>  Batch.remove_group() method?

I'm halfway through having batches automatically release groups that
are no longer being used (in order to fix a memory leak discovered by
a pyweek entrant earlier this week).

Alex.

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to