Exemple #1
0
        public StillLife()
        {
            InitializeComponent();

            ConfigFile config = new ConfigFile(@"config.ini");
            speedUpDown = config.SettingGroups["Movement"].Settings["SpeedUpDown"].GetValueAsFloat();
            speedLeftRight = config.SettingGroups["Movement"].Settings["SpeedLeftRight"].GetValueAsFloat();
            idleTexturePosition.Width = config.SettingGroups["Idle"].Settings["IdleX"].GetValueAsInt();
            idleTexturePosition.Height = config.SettingGroups["Idle"].Settings["IdleY"].GetValueAsInt();
            timeTillIdle = config.SettingGroups["Idle"].Settings["IdleAfter"].GetValueAsFloat();
            idleSpeed = config.SettingGroups["Idle"].Settings["IdleSpeed"].GetValueAsFloat();

            leapController = new Controller();
            leapListener = new LeapListener();
            leapController.AddListener(leapListener);
            leapListener.LeapSwipe += new LeapListener.SwipeEvent(OnSwipe);
            leapListener.LeapRegisterFingers += new LeapListener.RegisterFingers(OnRegisterFingers);

            CalculateColumnsRows();
            InitializeIdleValues();

            stopWatch.Start();
            updateThread = new Thread(UpdateThread);
            updateThread.Start();
        }
Exemple #2
0
        private LeapController()
        {
            var listener = new LeapListener();

            controller = new Controller(listener);
            Listener   = listener;
        }
Exemple #3
0
    // Use this for initialization
    void Start()
    {
        InitEvents();
        // initialize patient
        p1 = new Patient("Joe Bruin", 19836220, 1959, 08, 05, 'M', p1_events);

        DateTime temp = new DateTime(2020, 12, 31);

        Debug.Log(p1.GetInfo());
        Debug.Log(p1.GetEventsUpTo(temp)[14].GetInfo());
        DisplayOrbs();


        leapController = GameObject.Find("LeapHandController");
        listener       = GameObject.Find("LeapListener").GetComponent <LeapListener>();
        mainObject     = GameObject.Find("patient");
        gController    = GameObject.Find("GUIController").GetComponent <GuiController>();
        camera         = GameObject.Find("Main Camera").GetComponent <Camera>();


        // Verify that objects have been found
        if (listener != null)
        {
            Debug.Log("Listener: LISTENING");
        }
        if (mainObject != null)
        {
            Debug.Log("mainObject: IDENTIFIED");
        }


        camera           = GameObject.Find("Main Camera").GetComponent <Camera>();
        cameraController = GameObject.Find("Main Camera").GetComponent <CameraController>();
        currentGameState = gameState.FULL_BODY_VIEW;
    }
        public void Init()
        {
            controller = new Mock <Controller>();
            mouse      = new Mock <MouseController>();
            timer      = new Mock <Stopwatch>();

            listener = new LeapListener(controller.Object, mouse.Object, timer.Object);
        }
Exemple #5
0
 public void Init()
 {
     if (controller.IsConnected)
     {
         listener = new LeapListener();
         controller.AddListener(listener);
     }
 }
Exemple #6
0
    //Member Function: onAwake///////////////////////////////////////////////////
    public override void onAwake()
    {
        //This script will not be destroyed, even when a new level loads.
        DontDestroyOnLoad(gameObject);

        //Create a new Leap Listener.
        listener = new LeapListener();
    }
        private void initializeLeapListener()
        {
            // Create a listener and controller
            leap_listener = new LeapListener();
            leap_controller = new Controller();

            // Have the listener receive events from the controller
            leap_controller.AddListener(leap_listener);
        }
Exemple #8
0
        public LeapHandler()
        {
            // Create a sample listener and controller
            _LeapListener = new LeapListener();
            _Controller = new Controller();

            // Have the sample listener receive events from the controller
            _Controller.AddListener(_LeapListener);
        }
Exemple #9
0
 public LeapMotinn()
 {
     controller = new Controller();
     if (controller.IsConnected)
     {
         IsConnected = true;
         listener = new LeapListener();
         controller.AddListener(listener);
     }
 }
        public MainPage()
        {
            this.InitializeComponent();

            listener = new LeapListener();
            listener.OnFrameEvent += listener_OnFrameEvent;

            leap = new Controller();
            leap.AddListener( listener );
        }
Exemple #11
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var controller = new Controller();
            var system     = new Os();
            var listener   = new LeapListener(controller, new MouseController(system), new Stopwatch());

            Application.Run(new MainForm(controller, listener, system));
        }
Exemple #12
0
        public LeapController()
        {
            this.listener = new LeapListener();
            this.controller = new Controller();

            this.controller.SetPolicy(Controller.PolicyFlag.POLICY_BACKGROUND_FRAMES);
            this.controller.EnableGesture(Gesture.GestureType.TYPE_KEY_TAP);
            this.controller.EnableGesture(Gesture.GestureType.TYPE_SWIPE);
            this.controller.AddListener(listener);
            this.controller.Config.SetFloat("Gesture.Swipe.MinVelocity", 500.0f);
            this.controller.Config.Save();
        }
Exemple #13
0
 public void OnInitialize(CommunicationService com, int interval)
 {
     OnRelease();
     m_communication = com;
     m_interval = interval;
     m_timer = new Stopwatch();
     m_timer.Start();
     m_listener = new LeapListener(this);
     m_controller = new Controller();
     m_controller.SetPolicy(m_controller.PolicyFlags | Controller.PolicyFlag.POLICY_IMAGES | Controller.PolicyFlag.POLICY_BACKGROUND_FRAMES);
     m_controller.AddListener(m_listener);
 }
        private void startTracking()
        {
            
            this.leapListener = new LeapListener();
            leapListener.OnInitial(this.leapController, this.palmCursor, this.targetForm);
            this.leapController.AddListener(leapListener);
            
            //Thread trackingThread = new Thread(trackingTask);




        }
Exemple #15
0
        public MainWindow()
        {
            InitializeComponent();

            this.LeapController = new Controller();
            this.LeapListener   = new LeapListener();
            this.LeapController.AddListener(this.LeapListener);
            this.LeapListener.OnFingerLocationChanged += LeapListener_OnFingerLocationChanged;
            this.LeapListener.OnHandLocationChanged   += LeapListener_OnHandLocationChanged;

            this.Loaded  += MainWindow_Loaded;
            this.Closing += MainWindow_Closing;
        }
        /// <summary>
        /// Constructor for LeapInterface class
        /// </summary>
        public LeapInterface()
        {
            // Create a listener and controller
            this.listener = new LeapListener();
            this.controller = new Controller();

            // Have the sample listener receive events from the controller
            controller.AddListener(listener);
            controller.SetPolicyFlags(Controller.PolicyFlag.POLICY_BACKGROUND_FRAMES);

            // Register event handler
            listener.GestureMade += new EventHandler<GestureEvent>(ProcessGesture);
        }
Exemple #17
0
        public MainForm(Controller controller, LeapListener listener, Os system)
        {
            InitializeComponent();

            System = system;

            Controller = controller;
            controller.SetPolicy(Controller.PolicyFlag.POLICY_BACKGROUND_FRAMES);

            Listener            = listener;
            Listener.OnPinch   += OnPinch;
            Listener.OnMove    += OnMove;
            Listener.OnRepaint += (sender, args) => graphics.Clear(keyColor);
        }
Exemple #18
0
 public void OnRelease()
 {
     if (m_controller != null)
     {
         m_controller.RemoveListener(m_listener);
         m_controller.Dispose();
         m_controller = null;
     }
     m_listener = null;
     m_communication = null;
     if (m_timer != null)
     {
         m_timer.Stop();
         m_timer = null;
     }
 }
Exemple #19
0
        public static void Main()
        {
            // Create a sample listener and controller
            LeapListener listener   = new LeapListener();
            Controller   controller = new Controller();

            // Have the sample listener receive events from the controller
            controller.AddListener(listener);

            // Keep this process running until Enter is pressed
            Console.WriteLine("Press Enter to quit...");
            Console.ReadLine();

            // Remove the sample listener when done
            controller.RemoveListener(listener);
            controller.Dispose();
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            leap = new Controller();

#if false
            // ポーリング
            CompositionTarget.Rendering += CompositionTarget_Rendering;
#else
            // イベント

            // リスナーオブジェクトとFrameイベントを登録する
            listener = new LeapListener();
            listener.OnFrameEvent += listener_OnFrameEvent;

            // リスナーオブジェクトを登録する
            leap.AddListener(listener);
#endif
        }
        private void Window_Loaded( object sender, RoutedEventArgs e )
        {
            leap = new Controller();

            #if false
            // ポーリング
            CompositionTarget.Rendering += CompositionTarget_Rendering;
            #else
            // イベント

            // リスナーオブジェクトとFrameイベントを登録する
            listener = new LeapListener();
            listener.OnFrameEvent += listener_OnFrameEvent;

            // リスナーオブジェクトを登録する
            leap.AddListener(listener);
            #endif
        }
Exemple #22
0
    public static void init()
    {
        if (inited)
        {
            dispose();
        }

        // Create a sample listener and controller
        listener   = new LeapListener();
        controller = new Controller();

        // Have the sample listener receive events from the controller
        controller.AddListener(listener);

        inited  = true;
        enabled = true;

        Debug.Log("inited leap motion listener");
    }
Exemple #23
0
        /*
        public LeapListener MyListener
        {
            get { return (LeapListener)GetValue(MyListenerProperty); }
            set { SetValue(MyListenerProperty, value); }
        }

        // Using a DependencyProperty as the backing store for MyListener.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty MyListenerProperty =
            DependencyProperty.Register("MyListener", typeof(LeapListener), typeof(MainWindow), new PropertyMetadata(new LeapListener()));
        */

        public MainWindow()
        {

            InitializeComponent();

            DataContext = this;
            // Create a sample listener and controller
            Listener = new LeapListener();

            //mGrid.DataContext = MyListener;

            Controller = new Controller();

            //// Have the sample listener receive events from the controller
            Controller.AddListener(Listener);

            //// Remove the sample listener when done
            //controller.RemoveListener (listener);
            //controller.Dispose ();
            mGrid.DataContext = Listener;
        }
        public MainWindowViewModel(ColorViewModel colorVM, LeapConnectInfoViewModel leapConnectInfo, IEventAggregator events, IWindowManager windowMan, IEventAggregator eventAggregator, GameViewModel gameVM)
        {
            gameViewModel    = gameVM;
            colorViewModel   = colorVM;
            _eventAggregator = eventAggregator;
            _leapCoord       = new int[3] {
                0, 0, 0
            };
            LeapCoord = new int[3] {
                0, 0, 0
            };
            _leapListener  = new LeapListener();
            _windowManager = windowMan;

            this.leapConnectInfoViewModel = leapConnectInfo;
            events.Subscribe(this);
            getInfo = new Thread(getInfoFromLeap);
            getInfo.Start();

            CaptureDevice = new FilterInfoCollection(FilterCategory.VideoInputDevice);
            foreach (FilterInfo Device in CaptureDevice)
            {
                Console.WriteLine("AAAA: " + Device.MonikerString);
            }
            try
            {
                if (CaptureDevice.Count != 0)
                {
                    FinalFrame           = new VideoCaptureDevice(CaptureDevice[0].MonikerString);
                    FinalFrame.NewFrame += new NewFrameEventHandler(FinalFrame_NewFrame);
                    FinalFrame.Start();
                }
            }
            catch
            {
            }
        }
Exemple #25
0
        public SensorDataWPF()
        {
            listener = new LeapListener();
            ctrl     = new Controller();

            ctrl.SetPolicyFlags(Controller.PolicyFlag.POLICYBACKGROUNDFRAMES);

            // Der Controller informiert allen Abonennten über Auslösung eines Events in der LeapListener-Klasse
            ctrl.AddListener(listener);
            // Abonnenten der ausgelösten Events
            listener.LeapPan              += PanAction;
            listener.LeapZoom             += ZoomAction;
            listener.LeapHandVelo         += HandVelocityAction;
            listener.LeapGestureRec       += HandGestureRec;
            listener.LeapPalmPosition     += HandPalmPosAction;
            listener.LeapHandSphereCenter += HandSphereCenterAction;
            listener.LeapHandSphereRadius += HandRadiusAction;
            listener.LeapHandFingersCount += HandFingersCount;
            listener.LeapPointablesCount  += PointablesCountAction;

            // Default-Wert der Skalierung => 100%
            // während der Entwicklungsphase: diente lediglich als Parameterwert zur Anzeige im MainWindow (WPF) - nicht sichtbar da "collapsed"
            Scale = 11;
        }
 //Member Function: onAwake///////////////////////////////////////////////////
 public override void onAwake()
 {
     listener = new LeapListener();
 }
        public static void testListener()
        {
            // Create a sample listener and controller
            LeapListener listener = new LeapListener();
            Controller controller = new Controller();

            // Have the sample listener receive events from the controller
            controller.AddListener(listener);

            // Keep this process running until Enter is pressed
            Console.WriteLine("Press Enter to quit...");
            Console.ReadLine();

            // Remove the sample listener when done
            controller.RemoveListener(listener);
            controller.Dispose();
        }
Exemple #28
0
 private LeapController()
 {
     var listener = new LeapListener();
     controller = new Controller(listener);
     Listener = listener;
 }
Exemple #29
0
        public MainWindow()
        {        
            // create delegate used for asynchronous calls 
            _delegateSelectTab = SelectTab;
            _delegatePopulateInspector = PopulateInspector;
         
            InitializeComponent();
            _captionStub = Text;

            AddEmptyTab();           
   
            // initialize UI state shelf with a default tab
            _ui = new UiState(new Tab(_emptyTab, null));
            _fps = new FpsTracker();

            // sync global UI with UIState
            framerateToolStripMenuItem.Checked = toolStripButtonShowFPS.Checked = _ui.ShowFps;
            lightingToolStripMenuItem.Checked = toolStripButtonShowShaded.Checked = _ui.RenderLit;
            texturedToolStripMenuItem.Checked = toolStripButtonShowTextures.Checked = _ui.RenderTextured;
            wireframeToolStripMenuItem.Checked = toolStripButtonWireframe.Checked = _ui.RenderWireframe;
            showNormalVectorsToolStripMenuItem.Checked = toolStripButtonShowNormals.Checked = _ui.ShowNormals;
            showBoundingBoxesToolStripMenuItem.Checked = toolStripButtonShowBB.Checked = _ui.ShowBBs;
            showAnimationSkeletonToolStripMenuItem.Checked = toolStripButtonShowSkeleton.Checked = _ui.ShowSkeleton;

            // manually register the MouseWheel handler
            glControl1.MouseWheel += OnMouseMove;

            // intercept all key events sent to children
            KeyPreview = true;

            InitRecentList();

#if LEAP
            //LeapMotion Support
            _leapListener = new LeapListener(this as MainWindow);
            _leapController = new Controller(_leapListener);
#endif

            // register listener for tab changs
           tabControl1.SelectedIndexChanged += (object o, EventArgs e) => {
               if (SelectedTabChanged != null)
               {
                   SelectedTabChanged(UiState.TabForId(tabControl1.SelectedTab));
               }
           };

            _initialized = true;
            StartUndoRedoUiStatePollLoop();
        }
    //Update/////////////////////////////////////////////////////////////////////
    public void Update()
    {
        if (listener == null)
        {
            listener = new LeapListener();
        }

        //Update the listener.
        listener.refresh();

        //Get a normalized box.
        normalizedBox = listener.frame.InteractionBox;

        //First, get any hands that are present.
        if (listener.hands > 0)
        {
            //Reset the hands array.
            if (hands != null)
            {
                for (int i = 0; i < hands.Length; i++)
                {
                    Destroy(hands[i]);
                }
            }

            //Initialize our hands.
            hands = new GameObject[listener.hands];

            //Loop over all hands.
            for (int i = 0; i < listener.hands; i++)
            {
                try
                {
                    //Create a new hand.
                    hands[i] = (GameObject)Instantiate(palm);

                    //Set its properties.
                    hands[i].transform.parent = camera.transform;
                    hands[i].name             = "Palm:" + i;

                    //Set up it's position.
                    Vector3 palmPosition = new Vector3(0, 0, 0);

                    palmPosition.x += listener.frame.Hands[i].PalmPosition.x / 10;
                    palmPosition.y += verticalOffset; palmPosition.y += listener.frame.Hands[i].PalmPosition.y / 10;
                    palmPosition.z += depth; palmPosition.z += (listener.frame.Hands[i].PalmPosition.z * -1) / 10;

                    //Move the hand.
                    hands[i].transform.localPosition = palmPosition;

                    //Set the hands rotation to neutral.
                    Quaternion lr = hands[i].transform.rotation;

                    Vector3 leap = listener.rotation(listener.frame.Hands[i]);

                    lr.eulerAngles = new Vector3(leap.x * -1, leap.y, leap.z);

                    hands[i].transform.localRotation = lr;
                }

                //Watch out for those pesky "index out of bounds" errors.
                catch (System.IndexOutOfRangeException e) { Debug.LogException(e); }
            }
        }

        //If there aren't any. delete any active palms.
        else if (hands != null)
        {
            for (int i = 0; i < hands.Length; i++)
            {
                Destroy(hands[i]);
            }
        }

        //Get any fingers that are present.
        if (listener.fingers > 0 && listener.hands > 0)
        {
            //Reset the fingers array.
            if (fingers != null && listener.fingers != fingers.Length)
            {
                for (int i = 0; i < fingers.Length; i++)
                {
                    Destroy(fingers[i]);
                }
            }

            //Initialize our fingers.
            if (fingers == null || listener.fingers != fingers.Length)
            {
                fingers = new GameObject[listener.fingers];
            }

            //Loop over all fingers.
            for (int i = 0; i < listener.fingers; i++)
            {
                try
                {
                    //Create a new finger.
                    if (fingers[i] == null)
                    {
                        fingers[i] = (GameObject)Instantiate(fingerTip);
                    }

                    //Set its properties.
                    fingers[i].name             = "Finger:" + i;
                    fingers[i].transform.parent = camera.transform;

                    //Set up it's position.
                    Vector3 tipPosition = new Vector3(0, 0, 0);

                    tipPosition.x += listener.frame.Fingers[i].TipPosition.x / 10;
                    tipPosition.y += verticalOffset; tipPosition.y += listener.frame.Fingers[i].TipPosition.y / 10;
                    tipPosition.z += depth; tipPosition.z += (listener.frame.Fingers[i].TipPosition.z * -1) / 10;

                    //Move the finger to where it belongs.
                    fingers[i].transform.localPosition = tipPosition;

                    //Set the fingers rotation to neutral.
                    Quaternion lr = fingers[i].transform.rotation;

                    lr.eulerAngles = Vector3.zero;

                    fingers[i].transform.localRotation = lr;
                }

                //Watch out for those pesky "index out of bounds" errors.
                catch (System.IndexOutOfRangeException e) { Debug.LogException(e); }
            }
        }

        //If not, delete any active fingers.
        else if (fingers != null)
        {
            for (int i = 0; i < fingers.Length; i++)
            {
                Destroy(fingers[i]);
            }
        }
    }
 //OnEnable///////////////////////////////////////////////////////////////////
 public void OnEnable()
 {
     listener = new LeapListener();
 }
        void OnStart(object sender, EventArgs e)
        {
            if (isStopped)
            {
                //Create a sample listener and controller
                listener = new LeapListener();
                controller = new Controller();

                // Have the sample listener receive events from the controller
                controller.AddListener(listener);

                isStopped = false;
            }
        }
 public LeapMouseController(LeapListener leapListener, LeapCustomController customController, MouseExecutor mouseFacade)
 {
     this.leapListener = leapListener;
     this.customController = customController;
     this.mouseFacade = mouseFacade;
 }
Exemple #34
0
 public LeapMouseController(LeapListener leapListener, LeapCustomController customController, MouseExecutor mouseFacade)
 {
     this.leapListener     = leapListener;
     this.customController = customController;
     this.mouseFacade      = mouseFacade;
 }
Exemple #35
0
    bool VjoyStart()
    {
        joystick = new vJoy();
        iReport  = new vJoy.JoystickState();

        // Device ID can only be in the range 1-16
        if (id <= 0 || id > 16)
        {
            ScreenLog.JLog.PrintToLog(string.Format("Illegal device ID {0}\nExit!", id));
            return(false);
        }

        // Get the driver attributes (Vendor ID, Product ID, Version Number)
        if (!joystick.vJoyEnabled())
        {
            ScreenLog.JLog.PrintToLog(string.Format("vJoy driver not enabled: Failed Getting vJoy attributes.\n"));
            return(false);
        }

        // Get the state of the requested device
        VjdStat status = joystick.GetVJDStatus(id);

        switch (status)
        {
        case VjdStat.VJD_STAT_OWN:
            ScreenLog.JLog.PrintToLog(string.Format("vJoy Device {0} is already owned by this feeder\n", id));
            break;

        case VjdStat.VJD_STAT_FREE:
            ScreenLog.JLog.PrintToLog(string.Format("vJoy Device {0} is free\n", id));
            break;

        case VjdStat.VJD_STAT_BUSY:
            ScreenLog.JLog.PrintToLog(string.Format("vJoy Device {0} is already owned by another feeder\nCannot continue\n", id));
            return(false);

        case VjdStat.VJD_STAT_MISS:
            ScreenLog.JLog.PrintToLog(string.Format("vJoy Device {0} is not installed or disabled\nCannot continue\n", id));
            return(false);

        default:
            ScreenLog.JLog.PrintToLog(string.Format("vJoy Device {0} general error\nCannot continue\n", id));
            return(false);
        }
        ;

        // Check which axes are supported
        bool AxisX  = joystick.GetVJDAxisExist(id, HID_USAGES.HID_USAGE_X);
        bool AxisY  = joystick.GetVJDAxisExist(id, HID_USAGES.HID_USAGE_Y);
        bool AxisZ  = joystick.GetVJDAxisExist(id, HID_USAGES.HID_USAGE_Z);
        bool AxisRX = joystick.GetVJDAxisExist(id, HID_USAGES.HID_USAGE_RX);
        bool AxisRZ = joystick.GetVJDAxisExist(id, HID_USAGES.HID_USAGE_RZ);

        // Get the number of buttons and POV Hat switchessupported by this vJoy device
        int nButtons      = joystick.GetVJDButtonNumber(id);
        int ContPovNumber = joystick.GetVJDContPovNumber(id);
        int DiscPovNumber = joystick.GetVJDDiscPovNumber(id);

        // Print results
        ScreenLog.JLog.PrintToLog(string.Format("\nvJoy Device {0} capabilities:\n", id));
        ScreenLog.JLog.PrintToLog(string.Format("Numner of buttons\t\t{0}\n", nButtons));
        ScreenLog.JLog.PrintToLog(string.Format("Numner of Continuous POVs\t{0}\n", ContPovNumber));
        ScreenLog.JLog.PrintToLog(string.Format("Numner of Descrete POVs\t\t{0}\n", DiscPovNumber));
        ScreenLog.JLog.PrintToLog(string.Format("Axis X\t\t{0}\n", AxisX ? "Yes" : "No"));
        ScreenLog.JLog.PrintToLog(string.Format("Axis Y\t\t{0}\n", AxisX ? "Yes" : "No"));
        ScreenLog.JLog.PrintToLog(string.Format("Axis Z\t\t{0}\n", AxisX ? "Yes" : "No"));
        ScreenLog.JLog.PrintToLog(string.Format("Axis Rx\t\t{0}\n", AxisRX ? "Yes" : "No"));
        ScreenLog.JLog.PrintToLog(string.Format("Axis Rz\t\t{0}\n", AxisRZ ? "Yes" : "No"));

        // Test if DLL matches the driver
        uint DllVer = 0, DrvVer = 0;
        bool match = joystick.DriverMatch(ref DllVer, ref DrvVer);

        if (match)
        {
            ScreenLog.JLog.PrintToLog(string.Format("Version of Driver Matches DLL Version ({0:X})\n", DllVer));
        }
        else
        {
            ScreenLog.JLog.PrintToLog(string.Format("Version of Driver ({0:X}) does NOT match DLL Version ({1:X})\n", DrvVer, DllVer));
        }

        // Acquire the target
        bool stat = ((status == VjdStat.VJD_STAT_OWN) || ((status == VjdStat.VJD_STAT_FREE)));
        bool acq  = (!joystick.AcquireVJD(id));

        if (stat && acq)
        {
            ScreenLog.JLog.PrintToLog(string.Format("Failed to acquire vJoy device number {0}.\n", id));
            return(false);
        }

        listener   = new LeapListener();
        controller = new Controller();
        joystick.ResetVJD(id);

        return(true);
    }
Exemple #36
0
    public static void init()
    {
        if (inited) dispose();

        // Create a sample listener and controller
        listener = new LeapListener();
        controller = new Controller();

        // Have the sample listener receive events from the controller
        controller.AddListener(listener);

        inited = true;
        enabled = true;

        Debug.Log("inited leap motion listener");
    }