On Sun, Nov 30, 2008 at 5:04 PM, Alex Holkner <[EMAIL PROTECTED]>wrote:

>
> On 12/1/08, Tristam MacDonald <[EMAIL PROTECTED]> wrote:
> >
> > On Sun, Nov 30, 2008 at 11:56 AM, Alex Holkner <[EMAIL PROTECTED]>
> > wrote:
> > >
> > >
> > >
> > >
> > > On Mon, Dec 1, 2008 at 3:30 AM, Tristam MacDonald <
> [EMAIL PROTECTED]>
> > wrote:
> > > >
> > > >
> > > > On Sat, Nov 29, 2008 at 8:24 PM, Alex Holkner <
> [EMAIL PROTECTED]>
> > > > wrote:
> > > >>
> > > >> You just need to schedule your update function on the clock (instead
> > > >> of in the draw method):
> > > >>
> > > >> def update(dt):
> > > >>    ship.update()
> > > >>
> > > >> period = 1 / 60.0 # 60 frames per second
> > > >> pyglet.clock.schedule_interval(update, period)
> > > >>
> > > >> Alex.
> > > >
> > > >
> > > > I am curious as to whether this actually guarantees that the window
> is
> > > > redrawn once per update. In particular, what happens if multiple
> > intervals
> > > > are scheduled on the clock? Does the window get redrawn according to
> the
> > > > shortest interval, or every time an interval expires?
> > >
> > > According to the shortest interval.  If multiple functions are
> > > scheduled for precisely the same time, they will be executed without
> > > redrawing in between them.
> > >
> > >
> > >
> > >
> > > Alex.
> > >
> >
> > Ok, thanks for clearing that up. My logic update runs at 60 Hz, while my
> fps
> > updates at 4 Hz. Since 4 | 60, I take it I should be safe scheduling them
> > both on the clock?
>
> If you schedule both on the clock, by default pyglet will call
> on_draw() at 60Hz or higher.  You can override this by setting
> window.invalid to False at the end of your on_draw(), and to True in
> your display update function.
>
> Alex.
>

Sweet, exactly what I needed!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to pyglet-users@googlegroups.com
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