On 3/6/08, Serg Kovrov <[EMAIL PROTECTED]> wrote:
>
>  I am very much for the new (1.1) style of main loop. Actually I do a
>  hybrid way - 'schedule' update routine when there is something to
>  update, and 'unschedule' when no tasks left to update.
>
>  The only problem is, for complex objects like particle systems,
>  separation of 'update' and 'draw' routines is hurting performance. In
>  case of particle it would be better to update each particle state and
>  draw it in place. I can't do it in 'on draw' handler, because I need
>  to know the time delta.
>
>  I guess I can workaround it by storing time delta globally on update
>  to use it in draw routines, but this does not feels natural.

Does this feel more palatable?

class ParticleSystem(object):
    def update(self, dt):
        self.next_dt = dt

    def draw(self):
        for particle in self.particles:
            # update and draw with self.next_dt

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