Microsoft.Xna.Framework.Graphics.ESImage.Initialize C# (CSharp) Method

Initialize() private method

private Initialize ( float scale ) : void
scale float
return void
        private void Initialize( float scale )
        {
            imageWidth = texture.ContentSize.Width;
            imageHeight = texture.ContentSize.Height;
            textureWidth = (int)(texture.PixelsWide/scale);
            textureHeight = (int)(texture.PixelsHigh/scale);
            texWidthRatio = 1.0f / (float)textureWidth;
            texHeightRatio = 1.0f / (float)textureHeight;
            textureOffsetX = 0;
            textureOffsetY = 0;
        }

Usage Example

Example #1
0
 public void AdjustScale(float factor)
 {
     texture.Initialize(1.0f / factor);
     _width  = (int)(texture.ImageWidth * factor);
     _height = (int)(texture.ImageHeight * factor);
 }