def draw(self,screen) : screen.fill(THECOLORS["lightblue"]) try : pts = [self.pymunk2pygame(x) for x in self.chime.get_points()] print pts pygame.draw.polygon(screen,THECOLORS["blue"],pts,1) except ValueError : #print 'junk' pass # when manually updating a body, need to set it's velocity BEFORE the call to world.update() velocity_scale = 10 velocity = Vec2d([x*velocity_scale for x in pygame.mouse.get_rel()]) self.cursor_ball.body.update_velocity(velocity,0,3) self.world.update() # when manually updating a body, need to set it's position AFTER the call to world.update() pos = self.input.get_com() self.cursor_ball.body.position = (pos[0],self.dims[1]-pos[1]) self.cursor_ball.body.update_position(0.01) self.draw_ball(screen,self.cursor_ball) if __name__ == "__main__" : #face_input = FaceInputProvider(0,(640,480),"/home/labadorf/development/aether-adam/examples/haarcascade_frontalface_alt.xml",flip=True) mouse_input = MouseInputProvider() driver = AetherDriver(640,input=mouse_input) driver.register_module(WindChimes(driver)) driver.run()
#screen.blit(scaled_raw_image,(0,0)) #screen.blit(raw_image,(0,0)) faces = self.input.get_polys() #faces = [] screen.blit(self.frame,(0,0)) if len(faces) > 0 : for i,face in enumerate(faces) : face = [(int(x[0]*self.dims[0]),int(x[1]*self.dims[1])) for x in face] dims = face[1][0]-face[0][0], face[2][1]-face[1][1] faces[i] = pygame.Rect(face[0],dims) self.sprite_tracker.update(faces,scaled_raw_image) print 'Sprite ages:',self.sprite_tracker._sprite_ages for i,sprite in enumerate(self.sprite_tracker.sprites) : scaled_face_surf = pygame.transform.scale(sprite.image,self.frame_scales[i]) screen.blit(scaled_face_surf,self.frame_coords[i]) num = self.font.render(str(i),False,THECOLORS['red']) screen.blit(num,self.frame_coords[i]) if __name__ == "__main__" : face_input = FaceInputProvider(0,(640,480),"/home/labadorf/development/aether/examples/haarcascade_frontalface_alt.xml",flip=True) driver = AetherDriver(640,input=face_input) driver.register_module(PictureFrames(driver)) driver.run()
else : if not in_seq : curr_seq = [v] in_seq = True else : curr_seq.append(v) if len(curr_seq) != 0 : inds.append(curr_seq) if self.clicked : self.clicked = False # clicked, toggle graphic if len(inds) == 2 : self.clicked = True self.on = not self.on self.image.fill(THECOLORS["white"]) if self.on : pygame.draw.circle(self.image,THECOLORS["red"],(5,5),5,1) else : pygame.draw.rect(self.image,THECOLORS["black"],(0,0,10,10),1) self.history = [] if __name__ == "__main__" : mouse_input = MouseInputProvider() driver = AetherDriver(640,input=mouse_input) module = Whiteboard(driver) driver.register_module(module) driver.run()