On Tue, Sep 29, 2009 at 2:48 PM, Oskar <[email protected]> wrote:
>
>

If I convert the images to sprites and add them to a batch, it takes

about 1/2500 of a second to draw them. But when I put the images in
> the batch I have to say where, in screen coordinates, I want the
> images. So when I scroll across the terrain those same tiles have new
> screen coordinates so I have to create a new batch, and with that I'm
> down to 1/20 of a second again.
>
> I suspect there is some way to get around this, so that I don't have
> to create a new batch every frame. If it was a 3D engine I would just
> have everything laid out and the engine would take care of drawing
> everything based on the camera---I want something like that here too
> if possible... or something.
>

Don't create a new batch, just change the position of each sprite (i.e.
change the x and y coordinates), and let the sprites handle updating the
batch.

However, you should probably do like a 3D engine would, and move the camera
(rather than the world), which bypasses the problem altogether.

-- 
Tristam MacDonald
http://swiftcoder.wordpress.com/

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