public void DrawCollectionTransform() { var collection = new Program.ShapeCollections(); collection.Parse(@" =Collection Triangle: light: 30,40: 10,10: 0: center Circle : dark : 10,30: 5, 5: 1.570796326794896619: center "); var display = new Program.Display(this.surface, offset: new Vector2(10f, 50f), scale: 0.5f, sprites: collection); using (Program.Display.Frame frame = display.DrawFrame()) { frame.DrawCollection("Collection", new Vector2(10, 20), Convert.ToSingle(Math.PI) / 2, this.scheme.MedDark); } var sprites = new List <MySprite>(this.surface.SpriteBuffer); Assert.AreEqual(4, sprites.Count, "Background + grid pattern + whatever other sprites were added"); MySprite sprite = sprites[1]; Assert.AreEqual("Triangle", sprite.Data); Assert.AreEqual(this.scheme.MedDark, sprite.Color); this.checkVector(new Vector2(-5, 75), sprite.Position.Value); Assert.AreEqual(Convert.ToSingle(Math.PI) / 2, sprite.RotationOrScale); sprite = sprites[2]; Assert.AreEqual("Circle", sprite.Data); Assert.AreEqual(this.scheme.MedDark, sprite.Color); Assert.AreEqual(new Vector2(0, 65), sprite.Position); Assert.AreEqual(Convert.ToSingle(Math.PI), sprite.RotationOrScale); }
public void DrawCollectionNoTransform() { var collection = new Program.ShapeCollections(); collection.Parse(@" =Collection Triangle: light: 30,40: 10,10: 0: center Circle : dark : 10,30: 5, 5: 1.570796: center "); var display = new Program.Display(this.surface, offset: new Vector2(10f, 50f), scale: 0.5f, sprites: collection); using (Program.Display.Frame frame = display.DrawFrame()) { frame.DrawCollection("Collection"); } var sprites = new List <MySprite>(this.surface.SpriteBuffer); Assert.AreEqual(4, sprites.Count, "Background + grid pattern + whatever other sprites were added"); MySprite sprite = sprites[1]; Assert.AreEqual("Triangle", sprite.Data); Assert.AreEqual(this.scheme.Light, sprite.Color); Assert.AreEqual(new Vector2(25f, 70f), sprite.Position); Assert.AreEqual(new Vector2(5f, 5f), sprite.Size); Assert.AreEqual(0, sprite.RotationOrScale); sprite = sprites[2]; Assert.AreEqual("Circle", sprite.Data); Assert.AreEqual(this.scheme.Dark, sprite.Color); Assert.AreEqual(new Vector2(15f, 65f), sprite.Position); Assert.AreEqual(new Vector2(2.5f, 2.5f), sprite.Size); Assert.AreEqual(MathHelper.PiOver2, sprite.RotationOrScale); }