Exemple #1
0
        public static Joypad TryConnect()
        {
            var pad = new Joypad();

            pad.controller = new Controller(UserIndex.One);

            if (pad.controller.IsConnected)
            {
                return(pad);
            }

            return(null);
        }
Exemple #2
0
        private void PollForDevices()
        {
            while (controller == null ||
                   !controller.IsConnected())
            {
                controller = Joypad.TryConnect();

                if (controller == null)
                {
                    Thread.Sleep(500);
                }
            }

            PollForInput();
        }