/// <summary>
        /// Responds to user input, accepting or cancelling the message box.
        /// </summary>
        public override void HandleInput(GameTime gameTime, InputState input)
        {
            PlayerIndex playerIndex;

            if (input.IsNewButtonPress(Buttons.A, ControllingPlayer, out playerIndex) || input.IsNewKeyPress(Keys.Enter, ControllingPlayer, out playerIndex))
            {
                gestureOptions[0].callback.Invoke(playerIndex);
            }
            if (input.IsNewButtonPress(Buttons.B, ControllingPlayer, out playerIndex) || input.IsNewKeyPress(Keys.Escape, ControllingPlayer, out playerIndex))
            {
                gestureOptions[1].callback.Invoke(playerIndex);
            }
        }
        /// <summary>
        /// Responds to user input, changing the selected entry and accepting
        /// or cancelling the menu.
        /// </summary>
        public override void HandleInput(GameTime gameTime, InputState input)
        {
            // For input tests we pass in our ControllingPlayer, which may
            // either be null (to accept input from any player) or a specific index.
            // If we pass a null controlling player, the InputState helper returns to
            // us which player actually provided the input. We pass that through to
            // OnSelectEntry and OnCancel, so they can tell which player triggered them.
            PlayerIndex playerIndex;

            usingKinect = input.Kinect.IsEnabled() && input.Kinect.IsTrackingPlayer();
            if (usingKinect)
            {
                Vector2 handPos;
                Vector2 screenDimensions = new Vector2(ScreenManager.GraphicsDevice.Viewport.Width, ScreenManager.GraphicsDevice.Viewport.Height);
                Vector3 rawHandPos, referencePos;
                Vector3 hipPos = input.Kinect.GetJointPosition(JointType.HipCenter);
                float trackedWidth = input.Kinect.GetJointPosition(JointType.ShoulderRight).X - input.Kinect.GetJointPosition(JointType.ShoulderLeft).X;
                if (Input.InputState.DominantSide == DominantSide.Right)
                {
                    rawHandPos = input.Kinect.GetJointPosition(JointType.HandRight);
                    referencePos = hipPos + new Vector3(trackedWidth / 2.0f, -trackedWidth / 2.0f, 0);
                }
                else
                {
                    rawHandPos = input.Kinect.GetJointPosition(JointType.HandLeft);
                    referencePos = hipPos - new Vector3(trackedWidth / 2.0f, trackedWidth / 2.0f,0);
                }
                Vector3 diff = rawHandPos - referencePos;
                handPos = screenDimensions * 0.5f + new Vector2(diff.X, diff.Y) * screenDimensions.X/2;
                selectionLoader.Position = handCursor.Position = handPos;

                int nowOver = HoverItemAt(handPos);
                if (nowOver == -1 || nowOver != entryOver)
                {
                    selectionLoader.ColorMap.Play();
                }

                entryOver = nowOver;

            }
            if (input.IsNewButtonPress(Buttons.DPadUp, ControllingPlayer, out playerIndex) || input.IsNewKeyPress(Keys.Up, ControllingPlayer, out playerIndex))
                HoverLastItem();

            if (input.IsNewButtonPress(Buttons.DPadDown, ControllingPlayer, out playerIndex) || input.IsNewKeyPress(Keys.Down, ControllingPlayer, out playerIndex))
                HoverNextItem();

            if (input.IsNewButtonPress(Buttons.A, ControllingPlayer, out playerIndex) || input.IsNewKeyPress(Keys.Enter, ControllingPlayer, out playerIndex))
                SelectAtHover(playerIndex);
            base.HandleInput(gameTime, input);
        }
 public override void HandleInput(GameTime gameTime, InputState input)
 {
     //RecognitionResult r = input.Kinect.GetNewestCommand();
     //if ((r != null && r.likelihood > 0.55 && r.word == "play") ||
         //this.ExitScreen();
     PlayerIndex playerIndex;
     if (input.IsNewKeyPress(Microsoft.Xna.Framework.Input.Keys.Space,ControllingPlayer,out playerIndex))
         this.ExitScreen();
     base.HandleInput(gameTime, input);
 }
        /// <summary>
        /// Lets the game respond to player input. Unlike the Update method,
        /// this will only be called when the gameplay screen is active.
        /// </summary>
        public override void HandleInput(GameTime gameTime, InputState input)
        {
            if (input == null)
                throw new ArgumentNullException("input");

            PlayerIndex playerIndex;
            // The game pauses either if the user presses the pause button, or if
            // they unplug the active gamepad. This requires us to keep track of
            // whether a gamepad was ever plugged in, because we don't want to pause
            // on PC if they are playing with a keyboard and have no gamepad at all!
            //bool gamePadDisconnected = !gamePadState.IsConnected && input.GamePadWasConnected[playerIndex];

            if (input.IsNewButtonPress(Buttons.Start, ControllingPlayer, out playerIndex) || input.IsNewKeyPress(Keys.Space, ControllingPlayer, out playerIndex))
            {
                OnPause(playerIndex);
            }

            else
            {

                if (input.IsNewKeyPress(Keys.OemPlus, ControllingPlayer, out playerIndex))
                    grid.Enlarge();
                else if (input.IsNewKeyPress(Keys.OemMinus, ControllingPlayer, out playerIndex))
                    grid.Shrink();
                if (input.IsNewKeyPress(Keys.G, ControllingPlayer, out playerIndex))
                    grid.render = !grid.render;

                if (input.IsNewButtonPress(Buttons.DPadUp, ControllingPlayer, out playerIndex) || input.IsNewKeyPress(Keys.Up, ControllingPlayer, out playerIndex))
                    OnUp(playerIndex);

                else if (input.IsNewButtonPress(Buttons.DPadDown, ControllingPlayer, out playerIndex) || input.IsNewKeyPress(Keys.Down, ControllingPlayer, out playerIndex))
                    OnDown(playerIndex);

                else if (input.IsNewButtonPress(Buttons.DPadLeft, ControllingPlayer, out playerIndex) || input.IsNewKeyPress(Keys.Left, ControllingPlayer, out playerIndex))
                    OnLeft(playerIndex);

                else if (input.IsNewButtonPress(Buttons.DPadRight, ControllingPlayer, out playerIndex) || input.IsNewKeyPress(Keys.Right, ControllingPlayer, out playerIndex))
                    OnRight(playerIndex);
            }
        }