no by batch i meant
batch = pyglet.graphics.Batch()
for img in images: #list of AbstractImages
pyglet.sprite.Sprite(img, batch=batch)
batch.draw()
which should be much faster than:
for sprite in sprites:
sprite.draw()
why is it faster to check each tile's position to be on the screen
than just addressing them by tile[x][y] with two nested loops??
On Sep 8, 10:02 pm, 3TATUK <[EMAIL PROTECTED]> wrote:
> By 'batch' i'm guessing you mean list? Anyway.. don't store coord data
> like that .. just attach an anchor_x and anchor_y to each image.
>
> And... the only way I can think of at the moment for blitting only
> those tiles that are 'on screen' is checking each image's anchor_x and
> anchor_y for being <= window width and <= window height, respectively.
>
> On Sep 8, 11:35 am, josch <[EMAIL PROTECTED]> wrote:
>
> > hi!
> > in my first attempt to build something useful i just threw together a
> > few lines of code that displayed animated water tiles.
> > i did this by creating a water animation and adding it to a batch as
> > sprites with the individual coordinates.
> > this does work correctly but surprisingly the framerate will drop
> > significantly to something like 0.6fps when i do this fullscreen with
> > 60x38 tiles (tile width/height: 32px) for my 1920x1200 resolution.
> > so it seems not to be the right way to do this kind of thing.
>
> > another thing: i only need to draw those tiles that are currently on
> > the screen what is the best way to do this? i would use a batch to
> > draw all tiles but when i do this i would have to dynamically add and
> > remove sprites from the batch(es) and this seems costly
>
> > i read the heffalump tile engine code but there the tiles are
> > individually drawn and not in a batch.
> > with every draw two nestested loops will draw every sprite necessary
> > but isnt this inferior to using a batch?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---