On Dec 21, 1:12 pm, Hello3171 <[email protected]> wrote: > I was just wondering how sprites and text labels (in particular) were > being cleaned up. I don't want to have a design flaw in my game which > means later on when I do find that I wasn't doing things properly it > is hard to fix the problem. > > Currently for every sprite I make the process is similar to this > (simplified): > > #Initially I create a sprite batch (only once) > sprite_batch = pyglet.graphics.Batch() > > #This occurs for every sprite that I make > texture = pyglet.resource.image(filename) > sprite = pyglet.sprite.Sprite(texture, batch=self.sprite_batch) > #Set sprite properties > sprite.color = ... > > #Draw the sprites > sprite_batch.draw() > > Now for cleaning up I simply call: "sprite.delete()" for every sprite > when I want to destroy my object. I just started doing this but I have > no idea what the correct procedure is (and the docs don't seem to have > them anywhere clearly explained!) > > How are the lifetimes of sprites, text labels and sprite batches > managed? Do I need to do anything (such as call sprite.delete() ) for > anything?
I was wondering exactly the same thing, especially since my Sprite images are dynamically generated Textures (derived from Labels to accelerate text rendering) Do I need to call delete on the Texture, if no other Sprites reference it, or just on the Sprite? -- 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.
