Beispiel #1
0
        private void HandleMouseInput(GameTime gameTime, Actor3D parent)
        {
            Vector2 mouseDelta =
                mouseManager.GetDeltaFromCentre(new Vector2(GameConstants.ScreenWidth / 2f,
                                                            GameConstants.ScreenHeight / 2f));

            mouseDelta *= rotationSpeed * gameTime.ElapsedGameTime.Milliseconds * rotationSpeed;

            if (!(mouseManager.Position.X < GameConstants.ScreenWidth / 2f + GameConstants.ScreenWidth * 0.1f &&
                  mouseManager.Position.X > GameConstants.ScreenWidth / 2f - GameConstants.ScreenWidth * 0.1f &&
                  mouseManager.Position.Y < GameConstants.ScreenHeight / 2f + GameConstants.ScreenHeight * 0.1f &&
                  mouseManager.Position.Y > GameConstants.ScreenHeight / 2f - GameConstants.ScreenHeight * 0.1f))
            {
                move += new Vector3(-1 * mouseDelta.X, mouseDelta.Y, 0);
            }

            if (move.Length() != 0)
            {
                parent.Transform3D.RotateBy(move);
            }
        }