Beispiel #1
0
    def __init__(self,
                 background=None,
                 gravity=None,
                 damping=0,
                 adamping=0,
                 rest_coeff=1,
                 sfriction=0,
                 dfriction=0,
                 stop_velocity=1e-6,
                 simulation=None):

        self.background = background
        self._render_tree = RenderTree()

        if simulation:
            self.simulation = simulation
        else:
            self.simulation = Simulation(gravity=gravity,
                                         damping=damping,
                                         adamping=adamping,
                                         rest_coeff=rest_coeff,
                                         sfriction=sfriction,
                                         dfriction=dfriction,
                                         stop_velocity=stop_velocity)

        # Controle de callbacks
        self.is_paused = False
        super(World, self).__init__()
Beispiel #2
0
    def __init__(self, background=None,
                 gravity=None, damping=0, adamping=0,
                 restitution=1, sfriction=0, dfriction=0,
                 bounds=None, max_speed=None,
                 simulation=None):

        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,
                sfriction=sfriction,
                dfriction=dfriction,
                max_speed=max_speed,
                bounds=bounds)

        self.is_paused = False
        super(World, self).__init__()
Beispiel #3
0
    def __init__(self,
                 background=None,
                 gravity=None,
                 damping=0,
                 adamping=0,
                 restitution=1,
                 friction=0,
                 bounds=None,
                 max_speed=None,
                 simulation=None):

        self.background = background
        self._render_tree = RenderTree()
        self._objects = []

        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

        # Populate world with user-customizable init
        self.init()

        # Saves instance
        self._last_instances.append(weakref.ref(self))

        # Connect signals
        self.autoconnect()