public override void Draw(SharpDXRenderer renderer)
        {
            Vector2 location = this.GetAbsoluteLocation();
            Vector2 size     = this.GetSize();

            renderer.FillRectangle(this.BackColor, location, size);
            renderer.DrawRectangle(this.ForeColor, location, size);

            Vector2[] points = new Vector2[NumberOfValues];
            long      max    = DynamicMaximum ? this.Values.Max() : this.Maximum;

            for (int i = 0; i < points.Length; i++)
            {
                points[i] = location + new Vector2(this.Width / (points.Length - 1) * i, this.Height - (this.Height - this.MarginTop - this.MarginBottom) / max * this.Values[i]);
            }
            renderer.DrawLines(this.ForeColor, points);

            string  maxString   = MiscUtils.GetUnitFromSize(max, true);
            Vector2 maxSize     = renderer.MeasureString(maxString, this.Font);
            Vector2 maxLocation = location + new Vector2(this.Width - maxSize.X, 0);

            renderer.DrawText(maxString, this.ForeColor, this.Font, maxLocation);
            renderer.DrawText(this.Text, this.ForeColor, this.Font, location);
            base.Draw(renderer);
        }
Exemple #2
0
        public override void Draw(SharpDXRenderer renderer)
        {
            base.Draw(renderer);
            float   fontSize = (float)Math.Ceiling(this.Font.FontSize);
            Vector2 size     = renderer.MeasureString(this.Text, this.Font);

            if (!this.FillParent)
            {
                this.Width = size.X + fontSize;
            }
            this.Height = size.Y;
            Vector2 location    = this.GetAbsoluteLocation();
            Vector2 box         = new Vector2(fontSize, fontSize);
            Vector2 boxLocation = new Vector2(location.X, location.Y + this.Height / 2f - box.Y / 2f);

            if (this.MouseOver)
            {
                renderer.FillRectangle(this.BackColor,
                                       new Vector2(location.X - MarginLeft, location.Y - MarginTop),
                                       new Vector2(this.Width + MarginLeft + MarginRight, this.Height + MarginTop + MarginBottom));
            }

            renderer.DrawRectangle(this.ForeColor, boxLocation, box);

            if (this.Checked)
            {
                renderer.FillRectangle(this.ForeColor, boxLocation + Vector2.One * 2, box - Vector2.One * 4);
            }

            renderer.DrawText(this.Text,
                              this.ForeColor,
                              this.Font,
                              new Vector2(location.X + box.X + MarginLeft, location.Y));
        }
        public override void Draw(SharpDXRenderer renderer)
        {
            base.Draw(renderer);
            float fontSize = (float)Math.Ceiling(this.Font.FontSize);
            Vector2 size = renderer.MeasureString(this.Text, this.Font);
            if (!this.FillParent)
                this.Width = size.X + fontSize;
            this.Height = size.Y;
            Vector2 location = this.GetAbsoluteLocation();
            Vector2 box = new Vector2(fontSize, fontSize);
            Vector2 boxLocation = new Vector2(location.X, location.Y + this.Height / 2f - box.Y / 2f);

            if(this.MouseOver)
                renderer.FillRectangle(this.BackColor,
                    new Vector2(location.X - MarginLeft, location.Y - MarginTop),
                    new Vector2(this.Width + MarginLeft + MarginRight, this.Height + MarginTop + MarginBottom));

            renderer.DrawRectangle(this.ForeColor, boxLocation, box);

            if (this.Checked)
                renderer.FillRectangle(this.ForeColor, boxLocation + Vector2.One * 2, box - Vector2.One * 4);

            renderer.DrawText(this.Text,
                this.ForeColor,
                this.Font,
                new Vector2(location.X + box.X + MarginLeft, location.Y));
        }
Exemple #4
0
        public override void Draw(SharpDXRenderer renderer)
        {
            Vector2 location = this.GetAbsoluteLocation();

            Vector2 boxLocation = new Vector2(location.X - this.MarginLeft, location.Y - this.MarginTop);
            Vector2 boxSize     = new Vector2(this.Width + this.MarginLeft + this.MarginRight, this.Height + this.MarginBottom + this.MarginTop);

            renderer.FillRectangle(this.BackColor,
                                   boxLocation,
                                   boxSize);
            renderer.DrawRectangle(this.ForeColor,
                                   boxLocation,
                                   boxSize);

            Vector2 textLocation = location + Vector2.UnitX * this.MarginLeft * 2 + Vector2.UnitY * this.MarginTop;
            Vector2 textSize     = renderer.MeasureString(this.Text, this.Font);

            renderer.DrawText(this.Text, this.ForeColor, this.Font, textLocation);

            Vector2 spacerLocation = location + Vector2.UnitY * textSize.Y + this.MarginTop * 3 * Vector2.UnitY - Vector2.UnitY * this.MarginLeft;
            Vector2 spacerSize     = new Vector2(this.Width, 2f);

            renderer.FillRectangle(this.ForeColor, spacerLocation, spacerSize);

            base.Draw(renderer);
        }
        public override void Draw(SharpDXRenderer renderer)
        {
            Vector2 location = this.GetAbsoluteLocation();
            Vector2 size = this.GetSize();

            if(this.MouseOver || this.DrawBackground)
                renderer.FillRectangle(this.BackColor,
                    new Vector2(location.X - MarginLeft, location.Y - MarginTop),
                    new Vector2(size.X + MarginLeft + MarginRight, size.Y + MarginTop + MarginBottom));
            if(this.DrawBorder)
                renderer.DrawRectangle(this.ForeColor,
                new Vector2(location.X - MarginLeft, location.Y - MarginTop),
                new Vector2(size.X + MarginLeft + MarginRight, size.Y + MarginTop + MarginBottom));

            float fontSize = (float)Math.Ceiling(this.Font.FontSize);
            Vector2 textSize = renderer.MeasureString(this.Text, this.Font);

            this.Height = textSize.Y;
            switch (this.TextAlign)
            {
                case TextAlignment.Center:
                    location.X += this.Width / 2f - textSize.X / 2f;
                    break;
                case TextAlignment.Right:
                    location.X += this.Width - textSize.X;
                    break;
            }
            renderer.DrawText(this.Text,
                this.ForeColor,
                this.Font,
                new Vector2(location.X + MarginLeft, location.Y));

            base.Draw(renderer);
        }
 public override void Draw(SharpDXRenderer renderer)
 {
     base.Draw(renderer);
     //Vector2 rightHalf = new Vector2(this.Width / 2f, 0);
     ////Right half of the window
     //renderer.DrawRectangle(
     //    this.ForeColor,
     //    rightHalf,
     //    new Vector2(this.Width /2f, this.Height));
     ////Levelbar
     //renderer.DrawRectangle(
     //    this.ForeColor,
     //    new Vector2(this.Width / 2f, 0),
     //    new Vector2(this.Width / 2f, this.Width * 0.0675f));
     //Levelbar items
     Vector2 item = new Vector2(this.Width * 0.0375f);
     Vector2 itemWidth = new Vector2(this.Width * 0.0375f, 0);
     Vector2 itemY = new Vector2(0, this.Width * 0.020f);
     Vector2 itemDistance = new Vector2(this.Width * 0.020f, 0);
     renderer.DrawRectangle(
         this.ForeColor,
         new Vector2(this.Width * 0.75f - item.X / 2f, this.Width * 0.020f),
         item);
     renderer.DrawRectangle(
         this.ForeColor,
         new Vector2(this.Width * 0.75f - item.X / 2f, 0) + itemY - itemDistance - itemWidth,
         item);
     renderer.DrawRectangle(
         this.ForeColor,
         new Vector2(this.Width * 0.75f - item.X / 2f, 0) + itemY - itemDistance * 2f - itemWidth * 2f,
         item);
     renderer.DrawRectangle(
         this.ForeColor,
         new Vector2(this.Width * 0.75f - item.X / 2f, 0) + itemY + itemDistance + itemWidth,
         item);
     ////Click-area
     //Vector2 areaSize = new Vector2(this.Width / 2f * 0.6f, this.Width * 0.15f);
     //Vector2 location = new Vector2(this.Width / 4f, this.Width / 2f * 0.7f);
     //renderer.DrawRectangle(
     //    this.ForeColor,
     //    rightHalf + location - areaSize / 2f,
     //    areaSize);
 }
 public override void Draw(SharpDXRenderer renderer)
 {
     Vector2 location = this.GetAbsoluteLocation();
     Vector2 boxLocation = new Vector2(location.X - this.MarginLeft, location.Y - this.MarginTop);
     Vector2 boxSize = new Vector2(this.Width + this.MarginLeft + this.MarginRight, this.Height + this.MarginBottom + this.MarginTop);
     renderer.FillRectangle(this.BackColor,
         boxLocation,
         boxSize);
     renderer.DrawRectangle(this.ForeColor,
         boxLocation,
         boxSize);
     base.Draw(renderer);
 }
        public override void Draw(SharpDXRenderer renderer)
        {
            Vector2 location = this.GetAbsoluteLocation();
            Vector2 size     = this.GetSize();
            Vector2 fillSize = new Vector2(size.X * (this.Value / this.Maximum), size.Y);

            renderer.FillRectangle(this.BackColor, location, size);
            renderer.FillRectangle(this.FillColor, location, fillSize);
            renderer.DrawRectangle(this.ForeColor, location, size);

            this.FillParent = true;
            base.Draw(renderer);
        }
Exemple #9
0
        public override void Draw(SharpDXRenderer renderer)
        {
            Vector2 location = this.GetAbsoluteLocation();
            Vector2 size     = this.GetSize();

            if (this.MouseOver)
            {
                renderer.FillRectangle(this.BackColor,
                                       new Vector2(location.X - MarginLeft, location.Y - MarginTop),
                                       new Vector2(size.X + MarginLeft + MarginRight, size.Y + MarginTop + MarginBottom));
            }

            renderer.DrawRectangle(this.ForeColor,
                                   new Vector2(location.X - MarginLeft, location.Y - MarginTop),
                                   new Vector2(size.X + MarginLeft + MarginRight, size.Y + MarginTop + MarginBottom));

            float   fontSize     = (float)Math.Ceiling(this.Font.FontSize);
            string  display      = string.Format("{0}: {1}", this.Text, this.Values != null ? this.Values[this.SelectedIndex].Item1 : "<none>");
            Vector2 textSize     = renderer.MeasureString(display, this.Font);
            Vector2 textLocation = location;

            this.Height = textSize.Y;
            switch (this.TextAlign)
            {
            case TextAlignment.Center:
                textLocation.X += this.Width / 2f - textSize.X / 2f;
                break;

            case TextAlignment.Right:
                textLocation.X += this.Width - textSize.X;
                break;
            }
            renderer.DrawText(display,
                              this.ForeColor,
                              this.Font,
                              new Vector2(textLocation.X + MarginLeft, textLocation.Y));

            renderer.DrawText("<", this.ForeColor, this.Font, location);
            textSize     = renderer.MeasureString(">", this.Font);
            textLocation = location + Vector2.UnitX * size.X - Vector2.UnitX * textSize.X;
            renderer.DrawText(">", this.ForeColor, this.Font, textLocation);
            base.Draw(renderer);
        }
        public override void Draw(SharpDXRenderer renderer)
        {
            Vector2 location = this.GetAbsoluteLocation();
            Vector2 size = renderer.MeasureString(this.Text, this.Font);

            if (!this.FillParent && !this.FixedWidth)
                this.Width = size.X;

            if(this.MouseOver)
                renderer.FillRectangle(this.BackColor,
                    new Vector2(location.X - MarginLeft, location.Y - MarginTop),
                    new Vector2(this.Width + MarginLeft + MarginRight, this.Height + MarginTop + MarginBottom));

            base.Draw(renderer);

            renderer.DrawRectangle(this.ForeColor,
                new Vector2(location.X - MarginLeft, location.Y - MarginTop),
                new Vector2(this.Width + MarginLeft + MarginRight, this.Height + MarginTop + MarginBottom));
        }
        public override void Draw(SharpDXRenderer renderer)
        {
            Vector2 location    = this.GetAbsoluteLocation();
            Vector2 boxLocation = new Vector2(location.X - this.MarginLeft, location.Y - this.MarginTop);
            Vector2 boxSize     = new Vector2(this.Width + this.MarginLeft + this.MarginRight, this.Height + this.MarginBottom + this.MarginTop);

            if (this.DrawBackground)
            {
                renderer.FillRectangle(this.BackColor,
                                       boxLocation,
                                       boxSize);
            }
            if (this.DrawBackground)
            {
                renderer.DrawRectangle(this.ForeColor,
                                       boxLocation,
                                       boxSize);
            }
            base.Draw(renderer);
        }
Exemple #12
0
        public override void Draw(SharpDXRenderer renderer)
        {
            Vector2 location = this.GetAbsoluteLocation();
            Vector2 size     = this.GetSize();

            if (this.MouseOver || this.DrawBackground)
            {
                renderer.FillRectangle(this.BackColor,
                                       new Vector2(location.X - MarginLeft, location.Y - MarginTop),
                                       new Vector2(size.X + MarginLeft + MarginRight, size.Y + MarginTop + MarginBottom));
            }
            if (this.DrawBorder)
            {
                renderer.DrawRectangle(this.ForeColor,
                                       new Vector2(location.X - MarginLeft, location.Y - MarginTop),
                                       new Vector2(size.X + MarginLeft + MarginRight, size.Y + MarginTop + MarginBottom));
            }

            float   fontSize = (float)Math.Ceiling(this.Font.FontSize);
            Vector2 textSize = renderer.MeasureString(this.Text, this.Font);

            this.Height = textSize.Y;
            switch (this.TextAlign)
            {
            case TextAlignment.Center:
                location.X += this.Width / 2f - textSize.X / 2f;
                break;

            case TextAlignment.Right:
                location.X += this.Width - textSize.X;
                break;
            }
            renderer.DrawText(this.Text,
                              this.ForeColor,
                              this.Font,
                              new Vector2(location.X + MarginLeft, location.Y));

            base.Draw(renderer);
        }
        public override void Draw(SharpDXRenderer renderer)
        {
            base.Draw(renderer);

            if (this.ChildControls.Count == 0)
            {
                return;
            }

            TabHeaders = new RectangleF[ChildControls.Count];
            int     idx      = 0;
            Vector2 location = this.GetAbsoluteLocation();

            foreach (SharpDXControl panel in ChildControls)
            {
                Vector2 size = renderer.MeasureString(panel.Text, this.Font);
                if (idx == 0)
                {
                    TabHeaders[idx] = new RectangleF(0, 0, (float)Math.Max(MinimumHeaderWidth, size.X + this.MarginLeft + this.MarginRight), size.Y);
                }
                else
                {
                    TabHeaders[idx] = new RectangleF(TabHeaders[idx - 1].X + TabHeaders[idx - 1].Width, TabHeaders[idx - 1].Y, (float)Math.Max(MinimumHeaderWidth, size.X + this.MarginLeft + this.MarginRight), size.Y);
                }

                Vector2 tabLocation = location + new Vector2(TabHeaders[idx].X, TabHeaders[idx].Y);

                renderer.FillRectangle(this.BackColor, tabLocation, new Vector2(TabHeaders[idx].Width, TabHeaders[idx].Height));

                if (this.SelectedIndex == idx)
                {
                    renderer.FillRectangle(this.ForeColor * 0.1f, tabLocation, new Vector2(TabHeaders[idx].Width, TabHeaders[idx].Height));
                }

                renderer.DrawRectangle(this.ForeColor, tabLocation, new Vector2(TabHeaders[idx].Width, TabHeaders[idx].Height));
                renderer.DrawText(panel.Text, this.ForeColor, this.Font, tabLocation + Vector2.UnitX * this.MarginLeft);
                idx++;
            }
        }
        public override void Draw(SharpDXRenderer renderer)
        {
            Vector2 location = this.GetAbsoluteLocation();

            Vector2 boxLocation = new Vector2(location.X - this.MarginLeft, location.Y - this.MarginTop);
            Vector2 boxSize = new Vector2(this.Width + this.MarginLeft + this.MarginRight, this.Height + this.MarginBottom + this.MarginTop);
            renderer.FillRectangle(this.BackColor,
                boxLocation,
                boxSize);
            renderer.DrawRectangle(this.ForeColor,
                boxLocation,
                boxSize);

            Vector2 textLocation = location + Vector2.UnitX * this.MarginLeft * 2 + Vector2.UnitY * this.MarginTop;
            Vector2 textSize = renderer.MeasureString(this.Text, this.Font);
            renderer.DrawText(this.Text, this.ForeColor, this.Font, textLocation);

            Vector2 spacerLocation = location + Vector2.UnitY * textSize.Y + this.MarginTop * 3 * Vector2.UnitY - Vector2.UnitY * this.MarginLeft;
            Vector2 spacerSize = new Vector2(this.Width, 2f);
            renderer.FillRectangle(this.ForeColor, spacerLocation, spacerSize);

            base.Draw(renderer);
        }
        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)
        {
            base.Draw(renderer);

            if (this.ChildControls.Count == 0)
                return;

            TabHeaders = new RectangleF[ChildControls.Count];
            int idx = 0;
            Vector2 location = this.GetAbsoluteLocation();

            foreach (SharpDXControl panel in ChildControls)
            {
                Vector2 size = renderer.MeasureString(panel.Text, this.Font);
                if (idx == 0)
                    TabHeaders[idx] = new RectangleF(0, 0, (float)Math.Max(MinimumHeaderWidth, size.X + this.MarginLeft + this.MarginRight), size.Y);
                else
                    TabHeaders[idx] = new RectangleF(TabHeaders[idx - 1].X + TabHeaders[idx - 1].Width, TabHeaders[idx - 1].Y, (float)Math.Max(MinimumHeaderWidth, size.X + this.MarginLeft + this.MarginRight), size.Y);

                Vector2 tabLocation = location + new Vector2(TabHeaders[idx].X, TabHeaders[idx].Y);

                renderer.FillRectangle(this.BackColor, tabLocation, new Vector2(TabHeaders[idx].Width, TabHeaders[idx].Height));

                if (this.SelectedIndex == idx)
                    renderer.FillRectangle(this.ForeColor * 0.1f, tabLocation, new Vector2(TabHeaders[idx].Width, TabHeaders[idx].Height));

                renderer.DrawRectangle(this.ForeColor, tabLocation, new Vector2(TabHeaders[idx].Width, TabHeaders[idx].Height));
                renderer.DrawText(panel.Text, this.ForeColor, this.Font, tabLocation + Vector2.UnitX * this.MarginLeft);
                idx++;
            }
        }
        public override void Draw(SharpDXRenderer renderer)
        {
            Vector2 location = this.GetAbsoluteLocation();
            Vector2 size = this.GetSize();
            Vector2 fillSize = new Vector2(size.X * (this.Value / this.Maximum), size.Y);

            renderer.FillRectangle(this.BackColor, location, size);
            renderer.FillRectangle(this.FillColor, location, fillSize);
            renderer.DrawRectangle(this.ForeColor, location, size);

            this.FillParent = true;
            base.Draw(renderer);
        }
        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();

            renderer.FillRectangle(this.BackColor, location, size);
            renderer.DrawRectangle(this.ForeColor, location, size);

            Vector2[] points = new Vector2[NumberOfValues];
            long max = DynamicMaximum ? this.Values.Max() : this.Maximum;
            for (int i = 0; i < points.Length; i++)
            {
                points[i] = location + new Vector2(this.Width / (points.Length - 1) * i, this.Height - (this.Height - this.MarginTop - this.MarginBottom) / max * this.Values[i]);
            }
            renderer.DrawLines(this.ForeColor, points);

            string maxString = MiscUtils.GetUnitFromSize(max, true);
            Vector2 maxSize = renderer.MeasureString(maxString, this.Font);
            Vector2 maxLocation = location + new Vector2(this.Width - maxSize.X, 0);
            renderer.DrawText(maxString, this.ForeColor, this.Font, maxLocation);
            renderer.DrawText(this.Text, this.ForeColor, this.Font, location);
            base.Draw(renderer);
        }