20 _inv_cycle_time(1./30),
32 TimedCycle(PN_stdfloat cycle_time,
int element_count) :
33 _cycle_time(cycle_time),
35 _element_count(element_count)
37 nassertv(_cycle_time > 0);
40 _inv_cycle_time = 1. / _cycle_time;
49 _element_count = element_count;
58 nassertv(cycle_time > 0);
59 if (_next_switch == -1)
65 _next_switch = _next_switch - _cycle_time + cycle_time;
67 _cycle_time = cycle_time;
68 _inv_cycle_time = 1. / _cycle_time;
79 unsigned int increment = (
unsigned int) ((current_time - _next_switch)
82 _next_switch += _cycle_time * increment;
83 _current_child = (_current_child + increment) % _element_count;
85 return _current_child;
static ClockObject * get_global_clock()
Returns a pointer to the global ClockObject.
void set_element_count(int element_count)
Set the number of elements being cycled through.
int next_element()
Set the number of elements being cycled through.
get_frame_time
Returns the time in seconds as of the last time tick() was called (typically, this will be as of the ...
void set_cycle_time(PN_stdfloat cycle_time)
Set the number of elements being cycled through.