/// <summary> /// Load a DragonBones instance from the JSON file at the given path. /// </summary> /// <param name="path">Relative or absolute path to the json DragonBones file.</param> /// <param name="texturer">The supplier that has all textures for the DragonBones file at the given path.</param> /// <param name="graphics">A GraphicsDevice used to initialize meshes for FFD if necessary.</param> /// <returns></returns> public static DragonBones FromJson(string path, ITextureSupplier texturer, GraphicsDevice graphics) { if (!File.Exists(path)) { throw new FileNotFoundException("Could not resolve the given path", path); } return(new DragonBones(texturer, graphics, DbData.FromJson(path))); }
internal DbArmature(string name, ITextureSupplier texturer, GraphicsDevice graphics, DragonBones creator) : base(name) { Creator = creator; Texturer = texturer; GraphicsDevice = graphics; Bones = new KeyedCollectionImpl <string, DbBone>(b => b.Name); Slots = new KeyedCollectionImpl <string, DbSlot>(s => s.Name); Animations = new KeyedCollectionImpl <string, DbAnimation>(a => a.Name); IkConstraints = new List <DbIkConstraint>(); }
internal DbMesh(DisplayData data, ITextureSupplier texturer, GraphicsDevice graphics) : base(data.Name) { _drawable = texturer.Get(data.Name); _originalVertices = data.Vertices; // reverse to go with MonoGames standard culling direction // TODO ideally this would happen at content build time along with any other computation _indices = data.Triangles.Reverse().ToArray(); _uvs = data.Uvs; _vertices = new VertexPositionColorTexture[_originalVertices.Length / 2]; // edges, userEdges? Initialize(graphics); }
internal DragonBones(ITextureSupplier texturer, GraphicsDevice graphics, DbData data) { Name = data.Name; Version = data.Version; IsGlobal = data.IsGlobal; FrameRate = data.FrameRate; _armatures = new List <DbArmature>(); foreach (var armatureData in data.Armatures) { var armature = new DbArmature(armatureData.Name, texturer, graphics, this); armature.Initialize(armatureData); _armatures.Add(armature); } }
public DbImage(string textureName, ITextureSupplier texturer) : base(textureName) { _texture = texturer.Get(textureName); }