Package spyre :: Module spyre :: Class TimeKeeper
[frames | no frames]

Type TimeKeeper

object --+    
         |    
    Object --+
             |
            TimeKeeper


Keeps track of time and engine progress. Also has provisions for calling callback functions/bound-methods after predetermined delays. see addDelay()

Does not have reference to engine, so same timekeeper class can track time for entire program, from engine to engine.
Method Summary
  iterate(self)
Update frame measure.
  addDelay(self, delay, func, args)
Adds a function to be be executed 'delay' ms later, with arguments 'args'.
  setup(self, tid)
Startup code to run after other objects are all constructed.
  step(self, count)
Set to only step the engine one frame.
  toggle(self)
Toggle the engine between playing and pausing.
  __init__(self, fps)
Initialize new instance.
  delayManager(self)
Exec delayed tasks whose time has arrived, and maintain queue.
  set_timer(self)
Enable timekeeper.
  shutdown(self)
Turn timer off.
    Inherited from Object
  display(self)
Display the object using OpenGL This method must be overridden.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Instance Variable Summary
  play: indicates whether update should run this frame, whether interface hasn't paused engine.

Class Variable Summary
    Inherited from Object
NoneType engine: makes engine accessible to displayable objects.
list opengl_state_dependent = []
float runTime: how long has engine been running?
int runTurn: how many frames have elapsed?

Method Details

iterate(self)

Update frame measure. Called by engine once per frame.

addDelay(self, delay, func, args)

Adds a function to be be executed 'delay' ms later, with arguments 'args'. These callbacks are synchronized with the framerate, so that each is called at the first frame after delay is complete; Timing granularity depends on frame rate.
Parameters:
delay - how many milliseconds to delay execution
func - function to be called
args - tuple of args to be passed to func when called

setup(self, tid)

Startup code to run after other objects are all constructed.
Parameters:
tid - pygame event id for timer event.

step(self, count=2)

Set to only step the engine one frame.

toggle(self)

Toggle the engine between playing and pausing.

__init__(self, fps=24)
(Constructor)

Initialize new instance.
Parameters:
fps - frames per second, defaults to 24
Overrides:
spyre.spyre.Object.__init__

delayManager(self)

Exec delayed tasks whose time has arrived, and maintain queue.

set_timer(self)

Enable timekeeper.

shutdown(self)

Turn timer off.

Instance Variable Details

play

indicates whether update should run this frame, whether interface hasn't paused engine.

Generated by Epydoc 2.1 on Sat Jan 07 17:58:16 2006 http://epydoc.sf.net