Beispiel #1
0
        /// <summary>
        /// Sets the scale relative to the pixels of the texture.
        /// </summary>
        /// <param name="texture">The texture.</param>
        /// <param name="rectangleSize">The scale in pixel.</param>
        public void SetScaleRelative(Texture texture, Vector2 rectangleSize)
        {
            Vector2 textureSize = new Vector2(texture.Width, texture.Height);

            Scale.Set(Vector2.Divide(rectangleSize, textureSize));
        }
Beispiel #2
0
        /// <summary>
        /// Sets the offset relative to the pixels of the texture.
        /// </summary>
        /// <param name="texture">The texture it should use.</param>
        /// <param name="pixelLocation">The offset in pixel.</param>
        public void SetOffsetRelative(Texture texture, Vector2 pixelLocation)
        {
            Vector2 textureSize = new Vector2(texture.Width, texture.Height);

            Offset.Set(Vector2.Divide(pixelLocation, textureSize));
        }