Exemple #1
0
        
        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()
        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()