public void Draw_All()
 {
     foreach (SpriteDrawTileClass BatchedSprite in SpriteGroup)
     {
         BatchedSprite.DrawOnMap();
     }
 }
示例#2
0
        public Button(BatchedSprite spr)
        {
            sprite       = spr;
            shadowSprite = new BatchedSprite(spr.Position, spr.AtlasPosition, spr.ZOrder - 1);

            spr.Colour             = Config.Colors["buttons"];
            shadowSprite.Colour    = Config.Colors["shadow"];
            shadowSprite.Position += new Vector2f(0, 1);

            Program.SpriteBatch.Add(spr);
            Program.SpriteBatch.Add(shadowSprite);

            Program.Window.MouseButtonPressed += Window_MouseButtonPressed;
        }
        public static void DrawCircle(
            Vector2 textureTexel, RectangleF sourceRect, Vector2 center,
            float radius, Color color, float thickness, Vector2[] sides, BatchedSprite[] output)
        {
            if (output.Length < sides.Length)
            {
                throw new ArgumentException("Array is too small.", nameof(output));
            }

            void GetPolygonEdge(Vector2 point1, Vector2 point2, int index)
            {
                float   length = Vector2.Distance(point1, point2);
                float   angle  = (float)Math.Atan2(point2.Y - point1.Y, point2.X - point1.X);
                Vector2 scale  = new Vector2(length, thickness);

                ref BatchedSprite sprite = ref output[index];

                sprite.SetTexCoords(textureTexel, sourceRect);
                sprite.SetTransform(Matrix2.CreateFrom(point1, -angle, scale), sourceRect.Size);
                sprite.SetColor(color);
            }
 public static void DrawRef(this SpriteBatch batch, Texture2D texture, ref BatchedSprite sprite)
 {
     batch.DrawRef(texture, ref sprite.TL, ref sprite.TR, ref sprite.BL, ref sprite.BR);
 }
 public static void Draw(this SpriteBatch batch, Texture2D texture, BatchedSprite sprite)
 {
     DrawRef(batch, texture, ref sprite);
 }