Ejemplo n.º 1
0
    def __init__(self, ctx):
        super(SelfxBillardEye, self).__init__(ctx)
        self.x_threshold = XTHRESHOLD // 4
        self.y_threshold = YTHRESHOLD // 4

        self.drawer = OpencvDrawFuncs(w=self.x_threshold, h=self.y_threshold, ppm=1.0)
        self.b2 = b2World(gravity=(0, 0), doSleep=True)
Ejemplo n.º 2
0
    def __init__(self, ctx, aname):
        super(SelfxBillardWorld, self).__init__(ctx, aname)

        self.x_threshold = XTHRESHOLD
        self.y_threshold = YTHRESHOLD
        self.x_pos = self.x_threshold // 2
        self.y_pos = self.y_threshold // 2

        self.drawer = OpencvDrawFuncs(w=self.x_threshold, h=self.y_threshold, ppm=1.0)
        self.b2 = b2World(gravity=(0, 0), doSleep=True)

        self._state = self.available_states()[0]
        self._action = self.available_actions()[0]
Ejemplo n.º 3
0
    def __init__(self):
        """Initialisatie van de FrameworkBase klasse.
        """
        super(FrameworkBase, self).__init__()

        self.__reset()

        # Box2D Initialisatie
        self.world = b2World(gravity=(0, -10), doSleep=True)

        self.destructionListener = fwDestructionListener(test=self)
        self.world.destructionListener = self.destructionListener
        self.world.contactListener = self
        self.t_steps, self.t_draws = [], []
        self.fps = 0
        self.groundbody = 0
        self.settings.timeStep = 1 / 60
        self.settings.c_hz = 60
Ejemplo n.º 4
0
 def _makeWorld(self):
     self.world = b2World(gravity=(0, -10), doSleep=True)
     self.ground_body = self.world.CreateStaticBody(fixtures=b2FixtureDef(
         shape=b2EdgeShape(vertices=[(-1e5, 0), (1e5, 0)]),
         categoryBits=0x0002,
         maskBits=0x0004),
                                                    position=(0, 0),
                                                    userData='ground')
     self.helperEdge1 = self.world.CreateStaticBody(fixtures=b2FixtureDef(
         shape=b2EdgeShape(vertices=[(0, -1e5), (0, 1e5)]),
         categoryBits=0x0004,
         maskBits=0x0002),
                                                    position=(0, 0))
     self.helperEdge2 = self.world.CreateStaticBody(fixtures=b2FixtureDef(
         shape=b2EdgeShape(vertices=[(-1e5,
                                      self.MinHeight), (1e5,
                                                        self.MinHeight)]),
         categoryBits=0x0004,
         maskBits=0x0002),
                                                    position=(0, 0))