示例#1
0
        private static TiledMapLayerModelContent CreateImageLayerModel(TiledMapImageLayerContent imageLayer)
        {
            var model = new TiledMapLayerModelContent(imageLayer.Name, imageLayer.Image);

            // sprite/tile; same thing
            model.AddTileIndices();
            model.AddTileVertices(new Point2(imageLayer.X, imageLayer.Y));

            return(model);
        }
示例#2
0
        // ReSharper disable once SuggestBaseTypeForParameter
        private static void WriteModel(ContentWriter output, TiledMapLayerModelContent model)
        {
            output.Write(model.LayerName);
            output.Write(model.TextureAssetName);

            var vertexCount = model.Vertices.Count;

            output.Write(vertexCount);
            foreach (var vertex in model.Vertices)
            {
                output.Write(vertex.Position.X);
                output.Write(vertex.Position.Y);
                output.Write(vertex.TextureCoordinate.X);
                output.Write(vertex.TextureCoordinate.Y);
            }

            var indexCount = model.Indices.Count;

            output.Write(indexCount);
            foreach (var index in model.Indices)
            {
                output.Write(index);
            }
        }