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; }
public AnimatedSpriteAtlas(String xmlFile, String textureName, double msPerFrame) { this.atlas = XMLTextureAtlasReader.xmlToAtlas(xmlFile); atlas.setTexturePath(textureName); this.msPerFrame = msPerFrame; }
public AnimatedSpriteAtlas(String xmlFile) { this.atlas = XMLTextureAtlasReader.xmlToAtlas(xmlFile); msPerFrame = 100; }
public AnimatedSpriteAtlas(TextureAtlas textureAtlas) { this.atlas = textureAtlas; msPerFrame = 100; }