public override void Initialize()
        {
            base.Initialize();

            ControlHandler ch = new ControlHandler(this);
            Page page = new Page(this, "Page");
            page.Show();
            //Add our labels to the top
            _drawingtoolsTitle = new Label(page, "drawingtoolsTitle", new Point(0, 0));
            _drawingtoolsTitle.Text = "DrawingTools.Primitives";
            _drawingtoolsTitle.Body.Position = new Vector2(EntityGame.Viewport.Width / 4 - _drawingtoolsTitle.Render.DrawRect.Width / 2, 15);

            _renderTitle = new Label(page, "renderTitle", new Point(1, 0));
            _renderTitle.Text = "Rendering.Primitives";
            _renderTitle.Body.Position = new Vector2(EntityGame.Viewport.Width - (EntityGame.Viewport.Width / 4) - _renderTitle.Render.DrawRect.Width / 2, 15);

            _middleLine = new DrawingTools.Line(new Vector2(EntityGame.Viewport.Width / 2f, 10), new Vector2(EntityGame.Viewport.Width / 2f, EntityGame.Viewport.Height - 10));

            //Setup our prmitives
            _r1 = new DrawingTools.Rectangle(20, 40, 260, 60);
            _r1.Color = Color.Salmon;
            _r1.Fill = true;

            //Horizontal Lines
            _lx1 = new DrawingTools.Line(new Vector2(20, 105), new Vector2(270, 105), Color.Red);
            _lx1.Thickness = 1;

            _lx2 = new DrawingTools.Line(new Vector2(20, 110), new Vector2(270, 110), Color.Orange);
            _lx2.Thickness = 2;

            _lx3 = new DrawingTools.Line(new Vector2(20, 115), new Vector2(270, 115), Color.Yellow);
            _lx3.Thickness = 3;

            _ly1 = new DrawingTools.Line(new Vector2(270, 120), new Vector2(270, 290), Color.MediumPurple);
            _ly1.Thickness = 1;

            _ly2 = new DrawingTools.Line(new Vector2(275, 120), new Vector2(275, 290), Color.DodgerBlue);
            _ly2.Thickness = 2;

            _ly3 = new DrawingTools.Line(new Vector2(280, 120), new Vector2(280, 290), Color.LawnGreen);
            _ly3.Thickness = 3;

            //Add component based classes
            new SpinningRect(this, "Spinning", EntityGame.Viewport.Width / 2f + 75, 200, 30, 30, false, 3);
            new SpinningRect(this, "Spinning", EntityGame.Viewport.Width / 2f + 75, 200, 30, 30, false, 2);
            new SpinningRect(this, "Spinning", EntityGame.Viewport.Width / 2f + 75, 200, 30, 30, false, 1);
            new SpinningRect(this, "Spinning", EntityGame.Viewport.Width / 2f + 150 + 75, 200, 30, 30, true);

            new SpinningRect(this, "Spinning", EntityGame.Viewport.Width / 2f + 75, 300, 70, 30, false, 3);
            new SpinningRect(this, "Spinning", EntityGame.Viewport.Width / 2f + 75, 300, 70, 30, false, 2);
            new SpinningRect(this, "Spinning", EntityGame.Viewport.Width / 2f + 75, 300, 70, 30, false, 1);
            new SpinningRect(this, "Spinning", EntityGame.Viewport.Width / 2f + 150 + 75, 300, 30, 70, true);
        }
Beispiel #2
0
        public void DrawDebug(SpriteBatch sb)
        {
            if (_points.Count < 2 && _points.Count > 0)
            {
                //Only draw the one Point
                var singlepoint = new DrawingTools.Point((int)First.X, (int)First.Y);
                singlepoint.Thickness = 3;
                singlepoint.Color = DebugPointColor;
                singlepoint.Layer = 10;
            }
            else if (_points.Count < 0) return;

            //get our first line, then automate the rest.
            var point1 = new DrawingTools.Point((int) First.X, (int) First.Y);
            point1.Thickness = 3;
            point1.Color = DebugPointColor;
            point1.Layer = 1;
            point1.Draw(sb);

            var line = new DrawingTools.Line(new Vector2(First.X, First.Y), new Vector2(_points[1].X, _points[1].Y));
            line.Color = DebugLineColor;
            line.Layer = 1f;
            line.Draw(sb);

            var point2 = new DrawingTools.Point((int) _points[1].X, (int) _points[1].Y);
            point2.Thickness = 3;
            point2.Color = DebugPointColor;
            point2.Layer = 1;
            point2.Draw(sb);

            //Now we start getting the rest of the path
            for (int i = 2; i < Count; i++)
            {
                point1 = point2;

                point2 = new DrawingTools.Point((int) _points[i].X, (int) _points[i].Y);
                point2.Thickness = 3;
                point2.Color = DebugPointColor;
                point2.Layer = 1;
                point2.Draw(sb);

                line = new DrawingTools.Line(new Vector2(point1.X, point1.Y), new Vector2(point2.X, point2.Y), DebugLineColor);
                line.Layer = 1;
                line.Draw(sb);
            }
        }