예제 #1
0
파일: grid.py 프로젝트: ComSciCtr/vroom
   def _update(self, x, y, nx, ny):
      debug(msg='updating cache').flush()
      
      self.x = x
      self.y = y
      self.nx = nx
      self.ny = ny

      dx = self.x / self.nx
      dy = self.y / self.ny

      points = [ ]
      for i in range(nx):
         points.append([i*dx, 0.0, 0.0])
         points.append([i*dx,   y, 0.0])
      points.append([x, 0.0, 0.0])
      points.append([x, y,   0.0])

      for i in range(ny):
         points.append([0.0, i*dy, 0.0])
         points.append([x,   i*dy, 0.0])
      points.append([0, y, 0.0])
      points.append([x, y, 0.0])

      print('(x={}, y={})'.format(self.x, self.y))
      print('(nx={}, ny={})'.format(self.nx, self.ny))

      print('len(points)={}'.format(len(points)))

      self.buffer = Buffer(points)
      self.buffer.renderMode('lines')
예제 #2
0
파일: tracking.py 프로젝트: ComSciCtr/vroom
 def check_for_collision(self, pos):
    debug().flush()
    self.dragging = False
    for obj in self.tracked_objects:
       if obj.region.contains(pos):
          setattr(obj, 'active', True)
          self.dragging = True
          self.active  = { 'object': obj }
       elif hasattr(obj, 'active'):
          delattr(obj, 'active')
예제 #3
0
파일: tracking.py 프로젝트: ComSciCtr/vroom
 def add_object(self, obj):
    debug().add('object', obj).flush()
    self.tracked_objects.append(obj)
    debug(indent=1).add('tracked objects', len(self.tracked_objects))