container_1 = TouchObject() container_1.name = 'object_1' container_1.picture = OnscreenImage(image='media/logo.png',pos=(1,0,0),scale=0.25) container_1.scale = 0.25 self.touch_objects.update({container_1.name: container_1}) for name in self.touch_objects: # Tell GestureWorks about our touch object and add gestures to it self.gw.registerTouchObject(name) self.gw.addGesture(name, 'n-drag') self.gw.addGesture(name, 'n-rotate') self.gw.addGesture(name, 'n-scale') if __name__ == '__main__': # Initialize GestureWorksCore with the location of the library gw = GestureWorksCore('C:\\GestureWorksCore\\GestureworksCore32.dll') if not gw.loaded_dll: print 'Unable to load GestureWorksCore' exit() try: # Load a basic GML file gw.loadGML('C:\\GestureWorksCore\\basic_manipulation.gml') except WindowsError, e: print 'Unable to load GML' exit() gw.initializeGestureWorks(SCREEN_WIDTH, SCREEN_HEIGHT) app = MultitouchApp(gw) app.run()
if touch.status != TOUCHREMOVED: # Draw circles self.touch_images[touch.point_id] = OnscreenImage('ring_black.png', pos=(touch_x,0,touch_y), scale=.05) self.touch_images[touch.point_id].setTransparency(TransparencyAttrib.MAlpha) # Draw the touchpoint info label = 'ID: %d\nX: %d | Y: %d' %(touch.point_id,touch.position.x,touch.position.y) self.touch_text[touch.point_id] = OnscreenText(label,pos=(touch_x+0.1,touch_y), scale=.05,align=TextNode.ALeft) def updateGestureworks(self, task): self.gw.processFrame() point_events = gw.consumePointEvents() self.processTouchEvents(point_events) self.clearScreen(); self.drawTouchPoints() return Task.cont def build(self): if not self.gw.registerWindow('Panda'): print('Unable to register touch window') exit() if __name__ == '__main__': gw = GestureWorksCore('C:\\GestureworksCore\\GestureworksCore32.dll') if not gw.loaded_dll: print 'Unable to load GestureWorksCore' exit() gw.initializeGestureWorks(SCREEN_WIDTH, SCREEN_HEIGHT) app = MultitouchApp(gw) app.run()
# Draw the circles Color(*get_color_from_hex('ffe354')) Ellipse(pos=(touch_x - 20, touch_y + 20), size=(40,40)) Line(circle=(touch_x, touch_y + 40, 30, 0, 360), width=2) # Draw the touchpoint info label = Label(text='ID: {}\nX: {} | Y: {}'.format(touch.point_id, touch_x, touch_y)) label.center_x = touch_x + 80 label.center_y = touch_y + 80 label.color = (1,1,1) def updateGestureWorks(self, *args): self.root.canvas.clear() self.gw.processFrame() point_events = gw.consumePointEvents() self.processTouchEvents(point_events) self.drawTouchPoints() def build(self): if not self.gw.registerWindow('Kivy'): print('Unable to register touch window') exit() if __name__ == '__main__': gw = GestureWorksCore('C:\\path\\to\\GestureworksCore\\GestureworksCore32.dll') if not gw.loaded_dll: print 'Unable to load GestureWorksCore' exit() gw.initializeGestureWorks(1920, 1080) app = ExampleApp(gw) app.run()
self.gw.addGesture(image_name, 'n-rotate') self.gw.addGesture(image_name, 'n-scale') self.gw.addGesture(image_name, 'n-tap') video_file = join(curdir, 'media/videos/clock.mp4') alt_video_file = join(curdir, 'media/videos/meta/clock.png') video_name = 'clock' vid = self._create_collection_item(video_file, alt_video_file, (400,225), (400,400), 0, video_name, True) self.root.add_widget(vid) vid.main.play = True self.gw.registerTouchObject(video_name) self.gw.addGesture(video_name, 'n-drag') self.gw.addGesture(video_name, 'n-rotate') self.gw.addGesture(video_name, 'n-scale') self.gw.addGesture(video_name, 'n-tap') Factory.register('TouchObject', TouchObject) if __name__ == '__main__': bin_path = "C:\\gwdistro\\dev\\GestureworksCore\\" gw = GestureWorksCore(dll_path=bin_path + 'GestureworksCore32.dll') gw.initializeGestureWorks() try: gw.loadGML(bin_path + 'basic_manipulation.gml') except WindowsError, e: print 'Unable to load GML from', bin_path collection = CollectionApp(gw) collection.run()
container = TouchObject() container.name = 'object_{}'.format(i) container.add_widget(Image(source='media/logo.png')) container.scale = 2 self.root.add_widget(container) self.touch_objects.update({container.name: container}) # Tell GestureWorks about our touch object and add gestures to it self.gw.registerTouchObject(container.name) self.gw.addGesture(container.name, 'n-drag') self.gw.addGesture(container.name, 'n-rotate') self.gw.addGesture(container.name, 'n-scale') Factory.register('TouchObject', TouchObject) if __name__ == '__main__': # Initialize GestureWorksCore with the location of the library gw = GestureWorksCore('C:\\path\\to\\GestureWorksCore\\GestureWorksCore32.dll') if not gw.loaded_dll: print 'Unable to load GestureWorksCore' exit() try: # Load a basic GML file gw.loadGML('C:\\path\\to\\GestureWorksCore\\basic_manipulation.gml') except WindowsError, e: print 'Unable to load GML' exit() gw.initializeGestureWorks(1920, 1080) app = ExampleApp(gw) app.run()