Ejemplo n.º 1
0
        private void DrawRTSDatastructures()
        {
            float displayWidth  = GraphicsDevice.DisplayMode.Width;
            float displayHeight = GraphicsDevice.DisplayMode.Height;

            Vector2   origin    = new Vector2(displayWidth / 2, displayHeight / 2);
            Rectangle rectangle = new Rectangle(
                origin,
                displayWidth / 2, displayHeight / 2
                );

            rtsRendrer.Draw(rectangle, Color.Red, false);

            Vector2     p1     = new Vector2(displayWidth * .25f, displayHeight * 0.75f);
            Vector2     p2     = new Vector2(displayWidth * .25f, displayHeight * 0.25f);
            Vector2     p3     = new Vector2(displayWidth * .75f, displayHeight * 0.75f);
            Vector2     p4     = new Vector2(displayWidth * .75f, displayHeight * 0.25f);
            BezierCurve bCurve = new BezierCurve(p1, p2, p3, p4);

            rtsRendrer.DrawPoint(p1, Color.Red, 10);
            rtsRendrer.DrawPoint(p2, Color.Green, 10);
            rtsRendrer.DrawPoint(p3, Color.Blue, 10);
            rtsRendrer.DrawPoint(p4, Color.Purple, 10);
            rtsRendrer.Draw(bCurve, Color.White, 2, 1 / 1000f);
        }
Ejemplo n.º 2
0
        public void DrawScaledRectange(Rectangle rectangle, Color c)
        {
            Vector2   location        = rectangle.Origin * Scale;
            Rectangle sourceRectangle = new Rectangle(new Vector2(0, 0), rectangle.Width, rectangle.Length);
            Vector2   origin          = new Vector2(rectangle.Width / 2, rectangle.Length / 2);
            Vector2   scale           = new Vector2(Scale, Scale);

            dRenderer.Draw(sourceRectangle, c, location, origin, scale, rectangle.Angle);
        }
Ejemplo n.º 3
0
 public void Draw(Rectangle rect, Color c, bool filled = true)
 {
     if (filled)
     {
         float x = rect.TopLeft.X;
         float y = rect.TopLeft.Y;
         primitives2D.DrawRectangle(x, y, rect.Width, rect.Length, c, filled);
     }
     foreach (Segment side in rect.Sides)
     {
         Draw(side, c);
     }
 }
Ejemplo n.º 4
0
        public void Draw(Rectangle rect, Color c, Vector2 location, Vector2 origin, Vector2 scale, float angle)
        {
            Microsoft.Xna.Framework.Rectangle sourceRectangle = new Microsoft.Xna.Framework.Rectangle(
                (int)Math.Round(rect.Origin.X),
                (int)Math.Round(rect.Origin.Y),
                (int)Math.Round(rect.Width),
                (int)Math.Round(rect.Length));

            primitives2D.DrawRectangle(
                LinAlgConversion.XNAVector(location),
                sourceRectangle,
                angle,
                LinAlgConversion.XNAVector(origin),
                LinAlgConversion.XNAVector(scale),
                c);
        }