You can use something like this:

class AdjustableClock(pyglet.clock.Clock):
    __time = 0
    speed = 1

    def __init__(self):
        pyglet.clock.Clock.__init__(self, time_function=self.get_time)
        pyglet.clock.schedule(self.advance)

    def advance(self, time):
        self.__time += time * self.speed

    def get_time(self):
        return self.__time

..and use an instance of that clock everywhere (except e.g. animations
in the pause menu).
To pause, set the clock's speed to zero.


On Wed, Mar 6, 2013 at 11:33 PM, Winston Wolff
<[email protected]> wrote:
> I don't know off the top of my head but I know that cocos2d ( 
> http://cocos2d.org ) implements pause, and it uses Pyglet. You could 
> investigate that.
>
> -ww
>
> On Mar 6, 2013, at 2:21 PM, Joseph Clark <[email protected]> wrote:
>
>> Quick question: is there an easy way to pause and unpause the 
>> game/clock/scheduler with pyglet?  If now, how would you program this?
>>
>> --
>> 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.
>>
>>
>
> --
> 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.
>
>

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


Reply via email to