예제 #1
0
    def _update(self, dt):
        data = None
        try:
            data = self._ds.get(timeout = 0.01)
        except Queue.Empty:
            return

        if data['type'] != 'robot':
            return

        rid = data['id']

        x = data['pos']['x']
        y = data['pos']['y']

        x = int(x * 100)
        y = int(y * 100)

#        print "Updating robot '%d': %s" % ( rid, (x,y) )

        if not self._robots.has_key(rid):
            self._batch_robot(rid, (x,y))
        else:
            origin = glutils.make_origin((x,y), ROBOT_SIZE)
            (idx, verts) = glutils.sqaure_vertices(origin, ROBOT_SIZE)
            self._robots[rid].vertices = verts
예제 #2
0
	def _update(self, dt):
		data = None
		try:
			data = self._ds.get(timeout = 0.01)
		except Queue.Empty:
			return

		if data['type'] != 'robot':
			return

		rid = data['id']

		x = data['pos']['x']
		y = data['pos']['y']

		x = int(x * 100)
		y = int(y * 100)

		if not self._robots.has_key(rid):
			colour = colour_from_id(rid)
			self._robots[rid] = glutils.batch_robot(self._batch, (x, y), colour)
		else:
			(idx, verts) = glutils.sqaure_vertices((x,y), glutils.ROBOT_SIZE)
			self._robots[rid].vertices = verts