コード例 #1
0
        public static TextureAtlas xmlToAtlas(String xml)
        {
            TextureAtlas atlas = new TextureAtlas();
            XmlTextReader reader = new XmlTextReader(xml);

            while (reader.Read())
            {
                if (reader.Name.Equals("SubTexture"))
                {
                    atlas.SubTexturesList.Add(new SubTexture(reader.GetAttribute("name"), Int32.Parse(reader.GetAttribute("x")), Int32.Parse(reader.GetAttribute("y")), Int32.Parse(reader.GetAttribute("width")), Int32.Parse(reader.GetAttribute("height"))));
                }
            }

            atlas.setTexturePath(xml.Split('.')[0].Split('/')[xml.Split('/').Length-1]);

            return atlas;
        }
コード例 #2
0
 public AnimatedSpriteAtlas(String xmlFile, String textureName, double msPerFrame)
 {
     this.atlas = XMLTextureAtlasReader.xmlToAtlas(xmlFile);
     atlas.setTexturePath(textureName);
     this.msPerFrame = msPerFrame;
 }
コード例 #3
0
 public AnimatedSpriteAtlas(String xmlFile)
 {
     this.atlas = XMLTextureAtlasReader.xmlToAtlas(xmlFile);
     msPerFrame = 100;
 }
コード例 #4
0
 public AnimatedSpriteAtlas(TextureAtlas textureAtlas)
 {
     this.atlas = textureAtlas;
     msPerFrame = 100;
 }