Platformer.Camera.Camera2D.getTransform C# (CSharp) Method

getTransform() public method

public getTransform ( GraphicsDevice graphicsDevice ) : Matrix
graphicsDevice GraphicsDevice
return Matrix
        public Matrix getTransform(GraphicsDevice graphicsDevice)
        {
            // Thanks to o KB o for this solution
            transform = Matrix.CreateTranslation(new Vector3(-position.X, -position.Y, 0)) *
                                                    Matrix.CreateRotationZ(Rotation) *
                                                    Matrix.CreateScale(new Vector3(Zoom, Zoom, 1)) *
                                                    Matrix.CreateTranslation(new Vector3(graphicsDevice.Viewport.Width * 0.5f,graphicsDevice.Viewport.Height * 0.5f, 0));

            return transform;
        }