The first thing I'd try is drawing your images as batched sprites, as
described here:
http://pyglet.org/doc/1.1/api/pyglet.sprite-module.html

If that doesn't fix your performance problems, you could create a
texture that's the size of the final image, blit your tiles into it
once, and then draw that texture every time.  I think the blit_into
method (http://pyglet.org/doc/1.1/api/pyglet.image.Texture-class.html)
would be what you're looking for, but I haven't tried that, so ymmv...

hth,
Colin

On Fri, Jun 20, 2008 at 8:18 AM, kportertx <[EMAIL PROTECTED]> wrote:
>
> So I am creating a grid of images but having all the images load on
> each draw event is very slow, I was wondering if there were a way to
> combine all the images into one big image on the fly?
>
> My current code is as follows
>    def draw_mini_grid(self):
>        y1=0
>        for y in range(0,self.mini_grid.grid.height,1):
>            x1=0
>            for x in range(0,self.mini_grid.grid.width,1):
>                MINI_TYPE[self.mini_grid.grid.tiles[x]
> [y].tile_type].blit(x1,y1)
>                x1+=self.mini_grid.tile_size
>            y1+=self.mini_grid.tile_size
>        y1=0
>
> I would like something like this...
>    def draw_mini_grid(self):
>        new_image=0
>        y1=0
>        for y in range(0,self.mini_grid.grid.height,1):
>            x1=0
>            for x in range(0,self.mini_grid.grid.width,1):
>                new_image+=MINI_TYPE[self.mini_grid.grid.tiles[x]
> [y].tile_type].image_data.blit(x1,y1).
>                x1+=self.mini_grid.tile_size
>            y1+=self.mini_grid.tile_size
>        y1=0
>
> where it would be blit into a memory location instead of screen.. Or
> something equivalent.
>
> Any ideas?
>
> Thanks
> >
>

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