Package gameobjects :: Module gametime :: Class GameClock
[hide private]
[frames] | no frames]

Class GameClock

source code


Manages time in a game.

Instance Methods [hide private]
 
__init__(self, game_ticks_per_second=20)
Create a Game Clock object.
source code
 
start(self)
Starts the Game Clock.
source code
 
set_speed(self, speed)
Sets the speed of the clock.
source code
 
pause(self)
Pauses the Game Clock.
source code
 
unpause(self)
Un-pauses the Game Clock.
source code
 
get_real_time(self)
Returns the real time, as reported by the system clock.
source code
 
get_fps(self)
Retrieves the current frames per second as a tuple containing the fps and average fps over a second.
source code
 
get_between_frame(self)
Returns the interpolant between the previous game tick and the next game tick.
source code
 
update(self, max_updates=0)
Advances time, must be called once per frame.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, game_ticks_per_second=20)
(Constructor)

source code 

Create a Game Clock object.

game_ticks_per_second -- The number of logic frames a second.
Overrides: object.__init__

start(self)

source code 
Starts the Game Clock. Must be called once.

set_speed(self, speed)

source code 

Sets the speed of the clock.

speed -- A time factor (1 is normal speed, 2 is twice normal)

get_real_time(self)

source code 
Returns the real time, as reported by the system clock. This method may be overriden.

update(self, max_updates=0)

source code 

Advances time, must be called once per frame. Yields tuples of game frame count and game time.

max_updates -- Maximum number of game time updates to issue.