In this project I'm working on, the frame rate is supposed to be 60FPS (0.0167 seconds per frame), but it spikes as high as 0.03 seconds per frame whenever any input event occurs; it is especially noticeable when using on_mouse_drag. Here is event code I'm using:
@window.event def on_mouse_release(x,y,button,modifiers): global mousepressed; mousepressed=0 @window.event def on_mouse_press(x,y,button,modifiers): global mousex, mousey, mousepressed mousepressed=button; mousex=x; mousey=y @window.event def on_mouse_drag(x,y,dx,dy,button,modifiers): global mousex, mousey, mousepressed mousepressed=button; mousex=x; mousey=y @window.event def on_key_press(symbol,modifiers): global keypress; keypress=symbol @window.event def on_key_release(symbol,modifiers): global keyrelease; keyrelease=symbol pyglet.clock.schedule_interval(Mainloop,0.0167) pyglet.clock.set_fps_limit(60) pyglet.app.run() As you can see, these event functions are pretty barebones. Currently, the main loop constantly utilizes the mouse* variables regardless of whether the inputs are triggered. As of right now, the keypress and keyrelease variables are *not* in use anywhere outside of these 2 functions, yet they affect the frame rate anyway. All that being said, the problem must exist in the snippet shown. I tried removing the global definitions, which didn't help. -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscr...@googlegroups.com. To post to this group, send email to email@example.com. Visit this group at https://groups.google.com/group/pyglet-users. For more options, visit https://groups.google.com/d/optout.