flxSharp.flxSharp.FlxSprite.centerOffsets C# (CSharp) Méthode

centerOffsets() public méthode

Helper function that adjusts the offset automatically to center the bounding box within the graphic.
public centerOffsets ( bool adjustPosition = false ) : void
adjustPosition bool Adjusts the actual X and Y position just once to match the offset change. Default is false.
Résultat void
        public void centerOffsets(bool adjustPosition = false)
        {
            Offset.X = (FrameWidth - Width) * 0.5f;
            Offset.Y = (FrameHeight - Height) * 0.5f;

            if (adjustPosition)
            {
                X = X + Offset.X;
                Y = Y + Offset.Y;
            }
        }