def update(self, callback): now = time.time() self.accumulated += (now - self.last_time) self.last_time = now while self.accumulated > self.step: self.accumulated -= self.step callback()
def setUpClass(cls): arrival_count = 20 earliest_arrival_time = time.time(8, 0) # 8:00 latest_arrival_time = time.time(22, 59) # 22:59 turn_around_time = 1 * time.HOUR min_connection_time = 30 * time.MINUTE max_items_per_transfer = 5 cls._generator = TransferGenerator( arrival_count, earliest_arrival_time, latest_arrival_time, turn_around_time, min_connection_time, max_items_per_transfer, )
def render_effect(self, effect, fbo): effect.draw_quad( fbo.texture, [-1, -1, -1, 1, 1, -1, 1, 1], { 'time': (time.time() - self.started) % 314.1592653589793, 'size': (fbo.texture.w, fbo.texture.h), })
def __init__(self, app): self.app = app self.postprocessed = False self.global_tint = 1., 1., 1. self.started = time.time()
def __init__(self, fps): self.step = 1. / float(fps) self.accumulated = 0 self.last_time = time.time()