Пример #1
0
        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);
        }
Пример #2
0
        public override void Draw(SpriteBatch sb = null)
        {
            base.Draw(sb);

            if (Debug)
            {
                //Draw a bounding rect around it's drawrect
                var r = new DrawingTools.Rectangle(DrawRect.X, DrawRect.Y, DrawRect.Width, DrawRect.Height);
                r.Color     = Color.Red;
                r.Thickness = 1;
                r.Draw(sb);

                var origin = new DrawingTools.Point((int)(GetDependency <Body>(DEPENDENCY_BODY).Origin.X + DrawRect.X), (int)(GetDependency <Body>(DEPENDENCY_BODY).Origin.Y + DrawRect.Y));
                origin.Color = Color.Orange;
                origin.Draw(sb);
            }
        }