Exemplo n.º 1
0
        public override void Draw(SharpDXRenderer renderer)
        {
            Vector2 location       = this.GetAbsoluteLocation();
            Vector2 size           = this.GetSize();
            Vector2 marginLocation = location - Vector2.UnitX * this.MarginLeft - Vector2.UnitY * this.MarginTop;
            Vector2 marginSize     = size + Vector2.UnitX * this.MarginLeft + Vector2.UnitX * this.MarginRight + Vector2.UnitY * this.MarginTop + Vector2.UnitY * this.MarginBottom;

            //renderer.FillRectangle(this.BackColor, marginLocation, marginSize);
            //renderer.DrawRectangle(this.ForeColor, marginLocation, marginSize);

            string  text     = string.Format("{0} {1}", this.Text, Math.Round(this.value, this.NumberOfDecimals));
            Vector2 textSize = renderer.MeasureString(text, this.Font);

            renderer.DrawText(text, this.ForeColor, this.Font, location);

            trackbarLocation = location + Vector2.UnitY * textSize.Y;
            Vector2 trackBarHandleSize = new Vector2(TrackbarHeight, TrackbarHeight);

            trackbarLocation = location + Vector2.UnitY * (textSize.Y + MarginTop + TrackbarHeight / 2f) + Vector2.UnitX * TrackbarHeight / 2f;
            Vector2 trackbarSize           = new Vector2(size.X - TrackbarHeight, 0);
            Vector2 trackbarMarkerLocation = new Vector2(trackbarLocation.X + trackbarSize.X * Percent, trackbarLocation.Y);
            Vector2 trackbarMarkerSize     = new Vector2(TrackbarHeight / 4f, TrackbarHeight);

            renderer.DrawLine(this.ForeColor, trackbarLocation, trackbarLocation + trackbarSize, TrackbarHeight / 4f + 2f);
            renderer.DrawLine(this.BackColor, trackbarLocation, trackbarLocation + trackbarSize, TrackbarHeight / 4f);

            renderer.FillRectangle(this.ForeColor, trackbarMarkerLocation - (trackbarMarkerSize + 2f) / 2f, trackbarMarkerSize + 2f);
            renderer.FillRectangle(this.BackColor, trackbarMarkerLocation - trackbarMarkerSize / 2f, trackbarMarkerSize);

            this.Height = textSize.Y + TrackbarHeight + MarginTop + MarginBottom;

            base.Draw(renderer);
        }
Exemplo n.º 2
0
        protected void DrawLine(SharpDXRenderer renderer, Vector2 center, float distance, float length, float angle, float width, bool outline)
        {
            ExternalUtilsCSharp.MathObjects.Vector2 vecCenter  = SharpDXConverter.Vector2SDXtoEUC(center);
            ExternalUtilsCSharp.MathObjects.Vector2 vecRotateA = new MathObjects.Vector2(vecCenter.X + distance, vecCenter.Y);
            ExternalUtilsCSharp.MathObjects.Vector2 vecRotateB = new MathObjects.Vector2(vecCenter.X + distance + length, vecCenter.Y);
            vecRotateA = ExternalUtilsCSharp.MathUtils.RotatePoint(vecRotateA, vecCenter, angle);
            vecRotateB = ExternalUtilsCSharp.MathUtils.RotatePoint(vecRotateB, vecCenter, angle);
            Vector2 _vecRotateA = SharpDXConverter.Vector2EUCtoSDX(vecRotateA);
            Vector2 _vecRotateB = SharpDXConverter.Vector2EUCtoSDX(vecRotateB);

            if (outline)
            {
                renderer.DrawLine(this.SecondaryColor, _vecRotateA, _vecRotateB, width + 2f);
            }
            renderer.DrawLine(this.PrimaryColor, _vecRotateA, _vecRotateB, width);
        }
Exemplo n.º 3
0
        public override void Draw(SharpDXRenderer renderer)
        {
            Vector2 location      = this.GetAbsoluteLocation();
            Vector2 size          = this.GetSize();
            Vector2 controlCenter = location + size / 2f;
            Vector2 dotSize       = new Vector2(DotRadius * 2, DotRadius * 2);

            //Background
            renderer.FillRectangle(this.BackColor, location, size);
            renderer.DrawRectangle(this.ForeColor, location, size);
            //Zoom
            renderer.DrawText(string.Format("Zoom: {0}", Math.Round(Scaling, 4)), this.ForeColor, this.Font, location);
            //Grid
            renderer.DrawLine(this.ForeColor, location + Vector2.UnitX * size.X / 2f, location + Vector2.UnitX * size.X / 2f + Vector2.UnitY * size.Y);
            renderer.DrawLine(this.ForeColor, location + Vector2.UnitY * size.Y / 2f, location + Vector2.UnitY * size.Y / 2f + Vector2.UnitX * size.X);
            //Enemies
            if (Enemies != null)
            {
                foreach (Vector2 coord in Enemies)
                {
                    DrawDot(renderer, coord, EnemiesColor, controlCenter, dotSize);
                }
            }
            //Allies
            if (Allies != null)
            {
                foreach (Vector2 coord in Allies)
                {
                    DrawDot(renderer, coord, AlliesColor, controlCenter, dotSize);
                }
            }
            //Center
            renderer.FillEllipse(this.ForeColor, controlCenter, dotSize, true);

            base.Draw(renderer);
        }
        public override void Draw(SharpDXRenderer renderer)
        {
            Vector2 location = this.GetAbsoluteLocation();
            Vector2 size = this.GetSize();
            Vector2 marginLocation = location - Vector2.UnitX * this.MarginLeft - Vector2.UnitY * this.MarginTop;
            Vector2 marginSize = size + Vector2.UnitX * this.MarginLeft + Vector2.UnitX * this.MarginRight + Vector2.UnitY * this.MarginTop + Vector2.UnitY * this.MarginBottom;

            //renderer.FillRectangle(this.BackColor, marginLocation, marginSize);
            //renderer.DrawRectangle(this.ForeColor, marginLocation, marginSize);

            string text = string.Format("{0} {1}", this.Text, Math.Round(this.value, this.NumberOfDecimals));
            Vector2 textSize = renderer.MeasureString(text, this.Font);

            renderer.DrawText(text, this.ForeColor, this.Font, location);

            trackbarLocation = location + Vector2.UnitY * textSize.Y;
            Vector2 trackBarHandleSize = new Vector2(TrackbarHeight, TrackbarHeight);

            trackbarLocation = location + Vector2.UnitY * (textSize.Y + MarginTop + TrackbarHeight / 2f) + Vector2.UnitX * TrackbarHeight / 2f;
            Vector2 trackbarSize = new Vector2(size.X - TrackbarHeight, 0);
            Vector2 trackbarMarkerLocation = new Vector2(trackbarLocation.X + trackbarSize.X * Percent, trackbarLocation.Y);
            Vector2 trackbarMarkerSize = new Vector2(TrackbarHeight / 4f, TrackbarHeight);

            renderer.DrawLine(this.ForeColor, trackbarLocation, trackbarLocation + trackbarSize, TrackbarHeight / 4f + 2f);
            renderer.DrawLine(this.BackColor, trackbarLocation, trackbarLocation + trackbarSize, TrackbarHeight / 4f);

            renderer.FillRectangle(this.ForeColor, trackbarMarkerLocation - (trackbarMarkerSize + 2f) / 2f, trackbarMarkerSize + 2f);
            renderer.FillRectangle(this.BackColor, trackbarMarkerLocation - trackbarMarkerSize / 2f, trackbarMarkerSize);

            this.Height = textSize.Y + TrackbarHeight + MarginTop + MarginBottom;

            base.Draw(renderer);
        }
Exemplo n.º 5
0
        protected void DrawLine(SharpDXRenderer renderer, Vector2 center, float distance, float length, float angle, float width, bool outline)
        {
            ExternalUtilsCSharp.MathObjects.Vector2 vecCenter = SharpDXConverter.Vector2SDXtoEUC(center);
            ExternalUtilsCSharp.MathObjects.Vector2 vecRotateA = new MathObjects.Vector2(vecCenter.X + distance, vecCenter.Y);
            ExternalUtilsCSharp.MathObjects.Vector2 vecRotateB = new MathObjects.Vector2(vecCenter.X + distance + length, vecCenter.Y);
            vecRotateA = ExternalUtilsCSharp.MathUtils.RotatePoint(vecRotateA, vecCenter, angle);
            vecRotateB = ExternalUtilsCSharp.MathUtils.RotatePoint(vecRotateB, vecCenter, angle);
            Vector2 _vecRotateA = SharpDXConverter.Vector2EUCtoSDX(vecRotateA);
            Vector2 _vecRotateB = SharpDXConverter.Vector2EUCtoSDX(vecRotateB);

            if (outline)
                renderer.DrawLine(this.SecondaryColor, _vecRotateA, _vecRotateB, width + 2f);
            renderer.DrawLine(this.PrimaryColor, _vecRotateA, _vecRotateB, width);
        }
Exemplo n.º 6
0
        public override void Draw(SharpDXRenderer renderer)
        {
            Vector2 location = this.GetAbsoluteLocation();
            Vector2 size = this.GetSize();
            Vector2 controlCenter = location + size / 2f;
            Vector2 dotSize = new Vector2(DotRadius * 2, DotRadius * 2);
            //Background
            renderer.FillRectangle(this.BackColor, location, size);
            renderer.DrawRectangle(this.ForeColor, location, size);
            //Zoom
            renderer.DrawText(string.Format("Zoom: {0}", Math.Round(Scaling, 4)), this.ForeColor, this.Font, location);
            //Grid
            renderer.DrawLine(this.ForeColor, location + Vector2.UnitX * size.X / 2f, location + Vector2.UnitX * size.X / 2f + Vector2.UnitY * size.Y);
            renderer.DrawLine(this.ForeColor, location + Vector2.UnitY * size.Y / 2f, location + Vector2.UnitY * size.Y / 2f + Vector2.UnitX * size.X);
            //Enemies
            if (Enemies != null)
                foreach (Vector2 coord in Enemies)
                    DrawDot(renderer, coord, EnemiesColor, controlCenter, dotSize);
            //Allies
            if (Allies != null)
                foreach (Vector2 coord in Allies)
                    DrawDot(renderer, coord, AlliesColor, controlCenter, dotSize);
            //Center
            renderer.FillEllipse(this.ForeColor, controlCenter, dotSize, true);

            base.Draw(renderer);
        }