Thanks, Tristram, I think I'll have to do that. Do you know of anyone who's done something similar with pyglet before (i.e. an application which uses its own custom event loop)? This will be the first application I write with pyglet and so I'm hoping to learn the idiomatic "pyglet" way to do a lot of these things without having to wade through the pyglet source to make sure I don't forget anything. Because I remember some pyglet documentation that mentioned the possibility of writing your own custom event loop, but warned against doing it unless you really know what you're doing. Having a reference to look at from someone who did know what they were doing would be very helpful. Are there any other events I might need to manually dispatch, or any other methods i'd need to call each frame?
On Wednesday, 10 April 2013 15:45:04 UTC-4, swiftcoder wrote: > > On Wed, Apr 10, 2013 at 3:32 PM, Peter B <[email protected]<javascript:> > > wrote: > >> I'm trying to make a retro arcade style 2d game, and part of that >> requires that I have discrete per-frame logic (rather than based on delta >> since last update). For example, almost every visible element is going to >> be constantly cycling through 2-4 frame animations. More significantly, I'd >> like to simulate slowdown when lots of elements are onscreen; dynamically >> changing the FPS limit seemed like an easy enough way to do this, since it >> directly adjusts the period limit used in clock.tick. >> >> I was doing logic every frame through the scheduled update function, and >> relying on the "on_draw" method of pyglet.window to redraw after the >> scheduled functions completed- my assumption was that each invocation of >> "update" would be sandwiched between by two invocations of "on_draw", >> and vice versa. >> >> How should I organize my code? If I schedule my update function for >> every 1/60 seconds instead then I don't see how I'd be able to simulate >> slowdown without constant descheduling and rescheduling update at different >> speeds on each frame from within the update method. >> > > You can always write your own main loop... > > As long as you call Window.dispatch_events() each frame, you should be > able to manually call Window.clear() and Window.flip() as needed. > > -- > Tristam MacDonald > Software Development Engineer, Amazon.com > http://swiftcoder.wordpress.com/ > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/pyglet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
