def __init__(self, background=None, gravity=None, damping=0, adamping=0, restitution=1, friction=0, bounds=None, max_speed=None, simulation=None, force_init=True): if force_init: conf.init() conf.show_screen() self.background = background self._render_tree = RenderTree() self._input = conf.get_input() if simulation: self._simulation = simulation else: self._simulation = Simulation( gravity=gravity, damping=damping, adamping=adamping, restitution=restitution, friction=friction, max_speed=max_speed, bounds=bounds) self.is_paused = False super(World, self).__init__() # Inicia e popula o mundo self.init()
def run(self, timeout=None, **kwds): """ Runs simulation until the given timeout expires. Args: timeout (float): Maximum duration of simulation (in seconds). Leave None to run the simulation indefinitely. """ conf.init() conf.show_screen() self._mainloop.run(self, timeout=timeout, **kwds)
def _globals(self): conf.init() self._globals = conf return self._globals