Example #1
0
        public void can_parse_polygon_line_texture_animation()
        {
            var data = @"	4200 3 7 6 5 2 1 11 14 45 128 54 128 54 140";
            //	        4200                  3    7    6    5        2               1       11        14      45  128     54  128     54  140
            //[PolygonFlags] [Number of Points] [P1] [P2] [P3] [frames]  [playbackRate]  [width]  [height]    [VU] [VV]   [VU] [VV]   [VU] [VV]

            var result = PieGrammar.PolygonLine.Parse( data );

            var truth = new Polygon
                {
                    Flags = PolygonFlags.Animation | PolygonFlags.Texture,
                    PointCount = 3,
                    P1 = 7,
                    P2 = 6,
                    P3 = 5,
                    Frames = 2,
                    PlaybackRate = 1,
                    Width = 11,
                    Height = 14,
                    TexCoords = new[]
                        {
                            new TexCoord {U = 45, V = 128},
                            new TexCoord {U = 54, V = 128},
                            new TexCoord {U = 54, V = 140},
                        }
                };

            result.ShouldBeEquivalentTo(truth);
        }
Example #2
0
        public void can_parse_polygon_line()
        {
            var data = @"	200 3 3 2 1 237 220 239 220 239 222";

            //          200                 3     3    2    1    237  220    239  220    239  222
            //[PolygonFlags] [Number of Points] [P1] [P2] [P3]  [VU] [VV]   [VU] [VV]   [VU] [VV]

            var result = PieGrammar.PolygonLine.Parse(data);

            var truth = new Polygon
                {
                    Flags = PolygonFlags.Texture,
                    PointCount = 3,
                    P1 = 3,
                    P2 = 2,
                    P3 = 1,
                    Frames = 1,
                    PlaybackRate = 1,
                    TexCoords = new[]
                        {
                            new TexCoord {U = 237f, V = 220f},
                            new TexCoord {U = 239f, V = 220f},
                            new TexCoord {U = 239f, V = 222f},
                        }
                };

            result.ShouldBeEquivalentTo(truth);
        }