So I was trying out pyglet1.2alpha in my Snow Leopard.Either the pyglet.clock.tick() method doesn't get called periodically or the draw method doesn't.I wrote a code that should display incrementing number on each draw. It does increment but only after a long while.import pygletclass TestTick(object):def start(self):self.x = 1window = pyglet.window.Window()@window.eventdef on_draw():window.clear()self.x += 1label = pyglet.text.Label('Hello, world ' + str(self.x))label.draw()print('draw called')pyglet.app.run()test = TestTick()test.start()
Am I using it wrong here?--
You received this message because you are subscribed to the Google Groups "pyglet-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/pyglet-users/-/w0NpkVNdZe0J.
To post to this group, send email to pyglet...@googlegroups.com.
To unsubscribe from this group, send email to pyglet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en.
So I was trying out pyglet1.2alpha in my Snow Leopard.Either the pyglet.clock.tick() method doesn't get called periodically or the draw method doesn't.I wrote a code that should display incrementing number on each draw. It does increment but only after a long while.import pygletclass TestTick(object):def start(self):self.x = 1window = pyglet.window.Window()@window.eventdef on_draw():window.clear()self.x += 1label = pyglet.text.Label('Hello, world ' + str(self.x))label.draw()print('draw called')pyglet.app.run()test = TestTick()test.start()
Am I using it wrong here?
def update(dt): pass pyglet.clock.schedule_interval(update, 1.0/30.0)
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 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...@googlegroups.com.
Visit this group at http://groups.google.com/group/pyglet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.