private static void ParseRectangleItem(XmlNode rectangleItem, Vector2 scrollSpeed, String layerName)
        {
            ObjectInformation oi = new ObjectInformation();

            oi.scrollSpeed = scrollSpeed;
            oi.layer       = layerName;
            oi.name        = GetObjectName(rectangleItem);

            foreach (XmlNode child in rectangleItem.ChildNodes)
            {
                switch (child.Name)
                {
                case "Position":
                    oi.position = ExtractVector2(child);
                    break;

                case "CustomProperties":
                    oi.customProperties = ExtractCustomProperties(child);
                    break;

                case "Width":
                    oi.width = ExtractFloat(child);
                    break;

                case "Height":
                    oi.height = ExtractFloat(child);
                    break;
                }
            }

            //Adjust the position since Gleed handles textures' and primitives' positions differently.
            oi.position += new Vector2(oi.width / 2, oi.height / 2);

            objectProcessor.ProcessPrimitiveObject(oi);
        }
예제 #2
0
        private static void ProcessRectangleItem(string layer, Vector2 scrollSpeed, XmlNode properties)
        {
            ObjectInformation oi = new ObjectInformation();

            oi.scrollSpeed = scrollSpeed;
            oi.layer       = layer;
            oi.name        = "TEMP";

            foreach (XmlNode child in properties.ChildNodes)
            {
                switch (child.Name)
                {
                case "Name":
                    oi.name = child.InnerText;
                    break;

                case "Position":
                    oi.position = ExtractVector2(child);
                    break;

                case "CustomProperties":
                    oi.customProperties = ExtractCustomProperties(child);
                    break;

                case "Width":
                    oi.width = ExtractFloat(child);
                    break;

                case "Height":
                    oi.height = ExtractFloat(child);
                    break;

                case "Rotation":
                    oi.rotation = ExtractFloat(child);
                    break;
                }
            }

            //Adjust the position since Gleed handles textures' and primitives' positions differently.
            oi.position.X += oi.width / 2;
            oi.position.Y += oi.height / 2;

            objectProcessor.ProcessPrimitiveObject(oi);
        }