Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Wiimotes.ButtonClicked += Button;
            int numConnnected = Wiimotes.Connect(5);

            if (numConnnected > 0)
            {
                Console.WriteLine("{0} wiimote(s) found", numConnnected);
                Console.WriteLine("Press ENTER to quit");
                Console.ReadLine();
                Wiimotes.DisconnectAll();
            }
            else
            {
                Console.WriteLine("No Wiimotes found");
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            var port    = Convert.ToInt32(args[0]);
            var timeout = Convert.ToInt32(args[1]);
            var buffer  = new byte[12];

            client = new TcpClient();
            client.Connect(IPAddress.Loopback, port);
            client.Client.BeginReceive(termBuffer, 0, 1, SocketFlags.None,
                                       inputClient_DataReceived, null);

            Console.WriteLine("Connected to Nexus at 127.0.0.1:{0}", port);

            Wiimotes.ButtonClicked += Button;
            int numConnnected = Wiimotes.Connect(timeout);

            if (numConnnected > 0)
            {
                Console.WriteLine("{0} wiimote(s) found", numConnnected);

                CopyInt(ref buffer, 1, 0);
                CopyInt(ref buffer, numConnnected, 4);
                CopyInt(ref buffer, 0, 8);

                client.Client.Send(buffer);
                Wiimotes.Poll();
            }
            else
            {
                CopyInt(ref buffer, 1, 0);
                CopyInt(ref buffer, 0, 4);
                CopyInt(ref buffer, 0, 8);

                client.Client.Send(buffer);
                Console.WriteLine("No Wiimotes found");
            }
        }