Class cocos.custom_clocks.AutotestClock

pyglet.clock._ClockBase --+    
                          |    
         pyglet.clock.Clock --+
                              |
                             AutotestClock

Make frames follow a test plan

This class is compatible with pyglet 1.1.4release, it is not compatible with pyglet 1.2dev

Methods

  __init__(self, screen_sampler)
Initialise a Clock, with optional framerate limit and custom time function.
float tick(self, poll=False)
Signify that one frame has passed.
float get_sleep_time(self, sleep_idle)
Get the time until the next item is scheduled.
Inherited from pyglet.clock.Clock: call_scheduled_functions, get_fps, get_fps_limit, schedule, schedule_interval, schedule_interval_soft, schedule_once, set_fps_limit, unschedule, update_time Inherited from pyglet.clock._ClockBase: sleep

Constants

Inherited from pyglet.clock.Clock: MIN_SLEEP, SLEEP_UNDERSHOOT

Method Details

__init__

(Constructor) __init__(self, screen_sampler)
Initialise a Clock, with optional framerate limit and custom time function.
Overrides:
pyglet.clock.Clock.__init__

tick

tick(self, poll=False)

Signify that one frame has passed.

This will call any scheduled functions that have elapsed.

Returns:
float: The number of seconds since the last "tick", or 0 if this was the first frame.
Overrides:
pyglet.clock.Clock.tick

get_sleep_time

get_sleep_time(self, sleep_idle)

Get the time until the next item is scheduled.

This method considers all scheduled items and the current fps_limit, if any.

Applications can choose to continue receiving updates at the maximum framerate during idle time (when no functions are scheduled), or they can sleep through their idle time and allow the CPU to switch to other processes or run in low-power mode.

If sleep_idle is True the latter behaviour is selected, and None will be returned if there are no scheduled items.

Otherwise, if sleep_idle is False, a sleep time allowing the maximum possible framerate (considering fps_limit) will be returned; or an earlier time if a scheduled function is ready.

Returns:
float: Time until the next scheduled event in seconds, or None if there is no event scheduled.
Overrides:
pyglet.clock.Clock.get_sleep_time

Since: pyglet 1.1