public override void HandleInput(InputHelper input)
        {
            _xVelocity = 0;

            if (input.CurrentMouseState.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
            {
                if (input.CurrentMouseState.X >= 400)
                {
                    _xVelocity = 20;
                }
                else
                {
                    _xVelocity = -20;
                }
            }

            if (input.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Right))
            {
                _xVelocity = 20;
            }
            else if (input.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Left))
            {
                _xVelocity = -20;
            }
            _ballBody.LinearVelocity = new Vector2(_xVelocity, _ballBody.LinearVelocity.Y);

            base.HandleInput(input);
        }
Пример #2
0
 public override void HandleGamePadInput(InputHelper input)
 {
     base.HandleGamePadInput(input);
 }
Пример #3
0
 public override void HandleInput(InputHelper input)
 {
     _pnlMenu.HandleInput(input);
     base.HandleInput(input);
 }
Пример #4
0
 public override void HandleKeyboardInput(InputHelper input)
 {
     base.HandleKeyboardInput(input);
 }
Пример #5
0
 public override void HandleInput(InputHelper input)
 {
     if (!this.IsActive) return;
     pnl.HandleInput(input);
     base.HandleInput(input);
 }
Пример #6
0
 public virtual void HandleKeyboardInput(InputHelper input)
 {
     //Disabled in release versions of FPE
     //if (input.IsKeyDown(Keys.PageUp))
     //    ScreenManager.Camera.Zoom += 0.02f;
     //if (input.IsKeyDown(Keys.PageDown))
     //    ScreenManager.Camera.Zoom -= 0.02f;
     //if (input.IsKeyDown(Keys.Delete))
     //    ScreenManager.Camera.Rotation += 0.01f;
     //if (input.IsKeyDown(Keys.End))
     //    ScreenManager.Camera.Rotation -= 0.01f;
     //if (input.IsKeyDown(Keys.Left))
     //    ScreenManager.Camera.MoveCamera(new Vector2(-0.5f, 0));
     //if (input.IsKeyDown(Keys.Right))
     //    ScreenManager.Camera.MoveCamera(new Vector2(+0.5f, 0));
     //if (input.IsKeyDown(Keys.Down))
     //    ScreenManager.Camera.MoveCamera(new Vector2(0, -0.5f));
     //if (input.IsKeyDown(Keys.Up))
     //    ScreenManager.Camera.MoveCamera(new Vector2(0, +0.5f));
     //if (input.IsNewKeyPress(Keys.Home))
     //    ScreenManager.Camera.ResetCamera();
 }
Пример #7
0
 /// <summary>
 /// Allows the screen to handle user input. Unlike Update, this method
 /// is only called when the screen is active, and not when some other
 /// screen has taken the focus.
 /// </summary>
 public virtual void HandleInput(InputHelper input)
 {
     if (input.GamePadWasConnected[0])
     {
         HandleGamePadInput(input);
     }
     else
     {
         HandleKeyboardInput(input);
     }
 }
Пример #8
0
 public virtual void HandleGamePadInput(InputHelper input)
 {
     //Disabled in release versions of FPE
     if (input.CurrentGamePadState.Buttons.RightShoulder == ButtonState.Pressed)
         ScreenManager.Camera.Zoom += 0.02f;
     if (input.CurrentGamePadState.Buttons.LeftShoulder == ButtonState.Pressed)
         ScreenManager.Camera.Zoom -= 0.02f;
     ScreenManager.Camera.MoveCamera(input.CurrentGamePadState.ThumbSticks.Right / 2f);
     if (input.CurrentGamePadState.Buttons.RightStick == ButtonState.Pressed)
         ScreenManager.Camera.ResetCamera();
 }