Scale
Introduction
width = object.ScaleX * 2;
leftEdge = object.X - object.ScaleX;
rightEdge = object.X + object.ScaleX;Textures and Size
Sprite defaultScaleSprite = SpriteManager.AddSprite(@"Assets\Scenes\frblogo.png");
defaultScaleSprite.Y = 8;
// The size is relative to its source texture. Increase
// sizeCoefficient to increase size.
float sizeCoefficient = .02f;
Sprite correctAspectRatio = SpriteManager.AddSprite(@"Assets\Scenes\frblogo.png");
correctAspectRatio.Y = 0;
correctAspectRatio.ScaleX = correctAspectRatio.Texture.Width * sizeCoefficient;
correctAspectRatio.ScaleY = correctAspectRatio.Texture.Height * sizeCoefficient;
// This makes the Sprite drawn to-the-pixel.
Sprite pixelPerfectSprite = SpriteManager.AddSprite(@"Assets\Scenes\frblogo.png");
pixelPerfectSprite.Y = -11;
float pixelsPerUnit = SpriteManager.Camera.PixelsPerUnitAt(pixelPerfectSprite.Z);
pixelPerfectSprite.ScaleX = .5f * pixelPerfectSprite.Texture.Width / pixelsPerUnit;
pixelPerfectSprite.ScaleY = .5f * pixelPerfectSprite.Texture.Height / pixelsPerUnit;
Sizing and Positioning Objects
Identify the Most Influential Objects
Use Unit Sizes
Look at Visible Area
Last updated
Was this helpful?
