示例#1
0
        public static PolygonShape Parse(string p)
        {
            SimpleParser parser = new SimpleParser(p, true);

            Vec2[] vertices = SimpleArrayParser.GenerateArray <Vec2>((parser.ValueFromKey("vertices")), delegate(string input) { return(Vec2.Parse(input)); });

            return(new PolygonShape(vertices, Vec2.Parse(parser.ValueFromKey("Centroid"))));
        }
示例#2
0
        public static CircleShape Parse(string p)
        {
            SimpleParser parser = new SimpleParser(p, true);

            return(new CircleShape(Vec2.Parse(parser.ValueFromKey("Position")), float.Parse(parser.ValueFromKey("Radius"))));
        }
示例#3
0
文件: Fixture.cs 项目: prepare/box2c
        /// <summary>
        /// Parse a MassData from a string.
        /// </summary>
        /// <param name="value">The string to parse.</param>
        /// <returns>The new MassData.</returns>
        public static MassData Parse(string value)
        {
            SimpleParser parser = new SimpleParser(value, true);

            return(new MassData(float.Parse(parser.ValueFromKey("Mass")), Vec2.Parse(parser.ValueFromKey("Center")), float.Parse(parser.ValueFromKey("Inertia"))));
        }
示例#4
0
文件: Fixture.cs 项目: prepare/box2c
        /// <summary>
        /// Parse a FilterData out from a string.
        /// </summary>
        /// <param name="value">The string to parse from.</param>
        /// <returns>The new FilterData.</returns>
        public static FilterData Parse(string value)
        {
            SimpleParser parser = new SimpleParser(value, true);

            return(new FilterData(ushort.Parse(parser.ValueFromKey("CategoryBits")), ushort.Parse(parser.ValueFromKey("MaskBits")), short.Parse(parser.ValueFromKey("GroupIndex"))));
        }