Microsoft.Xna.Framework.PointExtensions.ToPositionMatrix C# (CSharp) Method

ToPositionMatrix() public static method

Creates a position matrix (in pixels) based on the position of a cell.
public static ToPositionMatrix ( this position, Point cellSize, bool absolutePositioning ) : Matrix
position this The cell position.
cellSize Point The size of the cell in pixels.
absolutePositioning bool When true, indicates that the indicates pixels, not cell coordinates.
return Matrix
        public static Matrix ToPositionMatrix(this Point position, Point cellSize, bool absolutePositioning)
        {
            Point worldLocation;

            if (absolutePositioning)
                worldLocation = position;
            else
                worldLocation = position.ConsoleLocationToWorld(cellSize.X, cellSize.Y);

            return Matrix.CreateTranslation(worldLocation.X, worldLocation.Y, 0f);
        }