Clock reports wrong fps when EventLoop.idle() is overridden

Hello,

I tried fixing my frame rate by overriding EventLoop.idle() method and
dispatching on_draw only in scheduled actions, however ClockDisplay is
now showing nonsense. It behaves as if every clock.tick() is followed
by on_draw event, but this isn't true anymore, so displayed fps is
higher than real fps. This program reproduces bug (if it's not a
feature):

#!/usr/bin/python
import pyglet

window = pyglet.window.Window(vsync = False)
event_loop = pyglet.app.EventLoop()
fps_display = pyglet.clock.ClockDisplay()

@window.event
def on_draw():
    window.clear()
    fps_display.draw()

def update(dt):
    if not window.has_exit:
        window.dispatch_event('on_draw')
        window.flip()

def idle():
    pyglet.clock.tick(True)
    return pyglet.clock.get_sleep_time(True)

pyglet.clock.schedule_interval(update, 1.0 / 30.0)
event_loop.idle = idle
event_loop.run()

It looks like problem is in clock.tick() method, it pushes new delta
time into sliding window every time it's called. I haven't tested SVN
version, but after quick look into repository I was unable to spot any
significant changes in there. Am I doing something wrong, or is it
really a bug?

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