Exemple #1
0
        /// <summary> Creates a new GuiPoint from the given XmlAttribute. </summary>
        /// <param name="attribute"> The XmlAttribute to parse. </param>
        internal GuiPoint(XmlAttribute attribute)
        {
            //If the attribute is null, default to an empty point
            if (attribute == null)
            {
                this = EmptyPoint; return;
            }

            //Split the attribute into values
            string[] pointValues = attribute.Value.Split(',');

            //If there's only one value, use this for both axes
            if (pointValues.Length == 1)
            {
                this = new GuiPoint(pointValues[0], pointValues[0]);
            }
            //If there's two values, use them for the axes
            else if (pointValues.Length == 2)
            {
                this = new GuiPoint(pointValues[0], pointValues[1]);
            }
            //If there's zero or more than two values, default to empty
            else
            {
                this = EmptyPoint;
            }
        }
Exemple #2
0
 /// <summary> Create a new Bounding with the given attributes and a parent container. </summary>
 /// <param name="anchorAttribute"> The attribute for the anchor. </param>
 /// <param name="positionAttribute"> The attribute for the position. </param>
 /// <param name="sizeAttribute"> The attribute for the size. </param>
 /// <param name="paddingAttribute"> The attribute for the padding. </param>
 /// <param name="container"> The parent container. </param>
 internal Bounding(XmlAttribute anchorAttribute, XmlAttribute positionAttribute, XmlAttribute sizeAttribute, XmlAttribute paddingAttribute, Rectangle container)
 {
     Anchor              = anchorAttribute.ParseVector2();
     Position            = new GuiPoint(positionAttribute);
     Size                = new GuiPoint(sizeAttribute);
     Padding             = new Padding(paddingAttribute);
     ParentContentBounds = container;
 }