当前位置: 首页>>代码示例>>C#>>正文


C# Controller.AddListener方法代码示例

本文整理汇总了C#中Controller.AddListener方法的典型用法代码示例。如果您正苦于以下问题:C# Controller.AddListener方法的具体用法?C# Controller.AddListener怎么用?C# Controller.AddListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Controller的用法示例。


在下文中一共展示了Controller.AddListener方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: initializeLeapListener

        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);
        }
开发者ID:ellak-monades-aristeias,项目名称:GSLT,代码行数:9,代码来源:Form1.cs

示例2: Main

 public static void Main()
 {
     SampleListener listener = new SampleListener();
     Controller controller = new Controller();
     controller.AddListener(listener);
     Console.WriteLine("Press Enter to quit...");
     Console.ReadLine();
     controller.RemoveListener(listener);
     controller.Dispose();
 }
开发者ID:TMCN,项目名称:TechCafe-Vol-01,代码行数:10,代码来源:Program.cs

示例3: Main

    public static void Main()
    {
        // Create a sample listener and controller
        SampleListener listener = new SampleListener();
        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();
    }
开发者ID:danielvbro,项目名称:Leap-Mouse-master,代码行数:17,代码来源:Sample.cs

示例4: LeapMotionGestureControl

    public LeapMotionGestureControl()
    {
        // Set up listener and controller
        listener = new LeapMotionGestureControlListener();
        controller = new Controller();

        // Allow background frames, otherwise.. well, it's useless
        controller.SetPolicy(Controller.PolicyFlag.POLICY_BACKGROUND_FRAMES);

        // Watch for circles
        controller.EnableGesture(Gesture.GestureType.TYPE_CIRCLE);
        controller.EnableGesture(Gesture.GestureType.TYPE_KEY_TAP);
        controller.EnableGesture(Gesture.GestureType.TYPE_SWIPE);

        // Add on the listener
        controller.AddListener(listener);
    }
开发者ID:govindraj513,项目名称:leap-motion-gesture-control,代码行数:17,代码来源:LeapMotionGestureControl.cs

示例5: Start

	void Start () {
		leapController = new Controller();
		leapListener = new Listener();
		
		// Log that the Leap Motion device is attached and recognized
		foreach(Device item in leapController.Devices)
		{
			Debug.Log("Leap Motion Device ID:" + item.ToString());
		}
		// Add a listener so that the controller is waiting for inputs
		leapController.AddListener(leapListener);
		// Check that the leap is fully connected and ready for input
		Debug.Log("Leap Motion connected: " + leapController.IsConnected);
		
		// Set up the gesture detection
		leapController.EnableGesture(Gesture.GestureType.TYPE_CIRCLE);
		Debug.Log("Circle Gesture Enabled: " + leapController.IsGestureEnabled(Gesture.GestureType.TYPE_CIRCLE));	
	}
开发者ID:MiloBuwalda,项目名称:wizard,代码行数:18,代码来源:MovementManager.cs

示例6: Main

    public static void Main()
    {
        // Create a sample listener and controller
        SampleListener listener = new SampleListener();
        Controller controller = new Controller();

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

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

        //creating socket
        //   UdpClient sendingClient = new UdpClient();
        //sendingClient.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
        //sendingClient.Connect("localhost", 4200);

        //Socket sending_socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
        //   IPAddress send_to_address = IPAddress.Parse("127.0.0.1");//localhost, for broadcast use ("192.168.2.255");
        //   IPEndPoint sending_end_point = new IPEndPoint(send_to_address, 4200);

        /*
        while(true)
        {



           // String text_to_send = "VR_TRACKER_SENSOR_0 42 24 66 0 0 0 0 0 0 1 2 3 4";
            //byte[] send_buffer = Encoding.ASCII.GetBytes(text_to_send);

            //Console.WriteLine("sending to address: {0} port: {1}",  sending_end_point.Address, sending_end_point.Port);
        
        
            try
            {
                //sending_socket.SendTo(send_buffer, sending_end_point);
                //sendingClient.Send(send_buffer, send_buffer.Length, sending_end_point);
            }
            catch (Exception send_exception)
            {
                //exception_thrown = true;
                Console.WriteLine(" Exception {0}", send_exception.Message);
            }
          
            Console.ReadLine();
            //System.Threading.Thread.Sleep(1000);
        }
        */
        // 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();
    }
开发者ID:GMDIT,项目名称:LeapChess,代码行数:55,代码来源:LMS.cs

示例7: getUserMove

    /**
     * This method gets the users move. A listener is created for the Leap Motion camera. 
     * The users move is obtained from the listener and is returned as the move for this round.
     */
    String getUserMove()
    {
        bool ready = false;
        SampleListener listener = new SampleListener();
        Controller controller = new Controller();
        controller.AddListener(listener);
    
        // Keep this process running until user makes thier move
        while(!ready)
        {
            // Wait until ready to get move
            if (MyStaticValues.count > 3)
            {
                System.Threading.Thread.Sleep(1000);
                ready = true;
                MyStaticValues.count = 0;
            }
        }

       // Console.WriteLine("move = " + listener.move);

        controller.RemoveListener(listener);
        controller.Dispose();

        return listener.move;
    }
开发者ID:gmurph52,项目名称:RockPaperScissors,代码行数:30,代码来源:Program.cs

示例8: Update

    void Update()
    {
        SampleListener listener = new SampleListener ();
        Controller controller = new Controller ();

        controller.AddListener (listener);

        controller.RemoveListener (listener);
        controller.Dispose ();

        //Clicktime.clicktime += Time.deltaTime;

        //if (Clicktime.clicktime > cooldown){
        approximateposition (Clicktime.finali, Clicktime.finalj);
        switch (Clicktime.gesture) {
        case 'c':
            //SpawnInductor (20,20, Clicktime.k);
            SpawnInductor (Clicktime.finali, Clicktime.finalj, -100);
            Debug.Log ("Spawning inductor");
            break;
        case 'k':
            //SpawnCapacitor(20,-20,Clicktime.k);
            SpawnCapacitor (Clicktime.finali, Clicktime.finalj, -100);
            Debug.Log ("Spawning capacitor");
            break;
        case 's':
            //SpawnResistor(-20,20,Clicktime.k);
            SpawnResistor (Clicktime.finali, Clicktime.finalj, -100);
            Debug.Log ("Spawning resistor");
            break;
        case 'w':
            //SpawnPower (-20,-20,Clicktime.k);
            SpawnPower (Clicktime.finali, Clicktime.finalj, -100);
            Debug.Log ("Spawning power");
            break;
        case 'p':
            if (Clicktime.location1 == 0) {
                if (Clicktime.IsLeft == true) { // if there is no first location and left node is indicated
                    if (Clicktime.finali == A.nx & Clicktime.finalj == A.ny) { // CaseA
                        Clicktime.xi = A.nx1;
                        Clicktime.yi = A.ny1;
                    } else if (Clicktime.finali == B.nx & Clicktime.finalj == B.ny) { // CaseB
                        Clicktime.xi = B.nx1;
                        Clicktime.yi = B.ny1;
                    } else if (Clicktime.finali == C.nx & Clicktime.finalj == C.ny) { // CaseC
                        Clicktime.xi = C.nx1;
                        Clicktime.yi = C.ny1;
                    } else if (Clicktime.finali == D.nx & Clicktime.finalj == D.ny) { // CaseD
                        Clicktime.xi = D.nx1;
                        Clicktime.yi = D.ny1;
                    }
                } else if (Clicktime.IsRight == true) {
                    // if there is no first location and right node is indicated
                    if (Clicktime.finali == A.nx & Clicktime.finalj == A.ny) { // CaseA
                        Clicktime.xi = A.nx2;
                        Clicktime.yi = A.ny1;
                    } else if (Clicktime.finali == B.nx & Clicktime.finalj == B.ny) { // CaseB
                        Clicktime.xi = B.nx2;
                        Clicktime.yi = B.ny1;
                    } else if (Clicktime.finali == C.nx & Clicktime.finalj == C.ny) { // CaseC
                        Clicktime.xi = C.nx2;
                        Clicktime.yi = C.ny1;
                    } else if (Clicktime.finali == D.nx & Clicktime.finalj == D.ny) { // CaseD
                        Clicktime.xi = D.nx2;
                        Clicktime.yi = D.ny1;
                    }
                }
                Clicktime.location1 = 1;
            }
            if (Clicktime.location1 != 0) {
                if (Clicktime.IsLeft == true) { // if there is first location and left node is indicated
                    if (Clicktime.finali == A.nx & Clicktime.finalj == A.ny) { // CaseA
                        Clicktime.xf = A.nx1;
                        Clicktime.yf = A.ny1;
                    } else if (Clicktime.finali == B.nx & Clicktime.finalj == B.ny) { // CaseB
                        Clicktime.xf = B.nx1;
                        Clicktime.yf = B.ny1;
                    } else if (Clicktime.finali == C.nx & Clicktime.finalj == C.ny) { // CaseC
                        Clicktime.xf = C.nx1;
                        Clicktime.yf = C.ny1;
                    } else if (Clicktime.finali == D.nx & Clicktime.finalj == D.ny) { // CaseD
                        Clicktime.xf = D.nx1;
                        Clicktime.yf = D.ny1;
                    }
                } else if (Clicktime.IsRight == true) {
                    // if there is first location and right node is indicated
                    if (Clicktime.finali == A.nx & Clicktime.finalj == A.ny) { // CaseA
                        Clicktime.xf = A.nx2;
                        Clicktime.yf = A.ny1;
                    } else if (Clicktime.finali == B.nx & Clicktime.finalj == B.ny) { // CaseB
                        Clicktime.xf = B.nx2;
                        Clicktime.yf = B.ny1;
                    } else if (Clicktime.finali == C.nx & Clicktime.finalj == C.ny) { // CaseC
                        Clicktime.xf = C.nx2;
                        Clicktime.yf = C.ny1;
                    } else if (Clicktime.finali == D.nx & Clicktime.finalj == D.ny) { // CaseD
                        Clicktime.xf = D.nx2;
                        Clicktime.yf = D.ny1;
                    }
                }
//.........这里部分代码省略.........
开发者ID:brendabrandy,项目名称:courses,代码行数:101,代码来源:myscript.cs

示例9: init

    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");
    }
开发者ID:fordream,项目名称:Anglers-Prey,代码行数:16,代码来源:LeapManager.cs

示例10: MainWindow

 public MainWindow()
 {
     InitializeComponent();
     this.controller = new Controller();
     this.listener = new LeapEventListener(this);
     controller.AddListener(listener);
     controller.SetPolicy(Controller.PolicyFlag.POLICY_BACKGROUND_FRAMES);
 }
开发者ID:LEECHHE,项目名称:LeapMotionKeyMapper,代码行数:8,代码来源:MainWindow.xaml.cs


注:本文中的Controller.AddListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。