Esempio n. 1
0
 public override void Render(Graphics graphics)
 {
     // TODO move to settings
     Color boxColor = Color.Gray;
     boxColor.A = 100;
     graphics.DrawBox(new RectangleF(Bounds.X, Bounds.Y, DesiredWidth, DesiredHeight), boxColor);
     var position = new Vector2(Bounds.X + 25, Bounds.Y + 12);
     var textColor = new ColorBGRA(255, 255, 255, 200);
     graphics.DrawText("Menu", 17, position, textColor, FontDrawFlags.VerticalCenter | FontDrawFlags.Center);
     Children.ForEach(x => x.Render(graphics));
 }
Esempio n. 2
0
 public override void Render(Graphics graphics, MenuSettings settings)
 {
     if (!IsVisible)
     {
         return;
     }
     float colorSize = DesiredHeight - 6;
     graphics.DrawImage("menu-background.png", new RectangleF(Bounds.X, Bounds.Y, Bounds.Width, Bounds.Height), settings.BackgroundColor);
     var textPosition = new Vector2(Bounds.X - 55 + Bounds.Width / 2 - colorSize, Bounds.Y + Bounds.Height / 2);
     graphics.DrawText(name, settings.MenuFontSize, textPosition, settings.MenuFontColor, FontDrawFlags.VerticalCenter | FontDrawFlags.Left);
     var colorBox = new RectangleF(Bounds.Right - colorSize - 1, Bounds.Top + 3, colorSize, colorSize);
     graphics.DrawImage("menu-colors.png", colorBox, node.Value);
 }
Esempio n. 3
0
 public override void Render(Graphics graphics, MenuSettings settings)
 {
     if (!IsVisible)
     {
         return;
     }
     string text = string.IsNullOrEmpty(path) ? "  Select file" : Path.GetFileName(path);
     float size = DesiredHeight - 2;
     graphics.DrawImage("menu-background.png", new RectangleF(Bounds.X, Bounds.Y, Bounds.Width, Bounds.Height), settings.BackgroundColor);
     var textPosition = new Vector2(Bounds.X + Bounds.Width / 2 - size / 2, Bounds.Y + Bounds.Height / 2);
     graphics.DrawText(text, settings.MenuFontSize, textPosition, settings.MenuFontColor, FontDrawFlags.VerticalCenter | FontDrawFlags.Center);
     var rectangle = new RectangleF(Bounds.Left + 5, Bounds.Top + 3, size, size - 5);
     graphics.DrawImage(string.IsNullOrEmpty(path) ? "openFile.png" : "done.png", rectangle);
 }
Esempio n. 4
0
        public override void Render(Graphics graphics)
        {
            if (!IsVisible)
            {
                return;
            }

            graphics.DrawBox(Bounds, Color.Black);
            graphics.DrawBox(new RectangleF(Bounds.X + 1, Bounds.Y + 1, Bounds.Width - 2, Bounds.Height - 2), Color.Gray);

            float colorSize = DesiredHeight - 2; // TODO move to settings
            var textPosition = new Vector2(Bounds.X + Bounds.Width / 2 - colorSize / 2, Bounds.Y + Bounds.Height / 2);
            // TODO textSize to Settings
            graphics.DrawText(name, 18, textPosition, Color.White, FontDrawFlags.VerticalCenter | FontDrawFlags.Center);
            var colorBox = new RectangleF(Bounds.Right - colorSize - 1, Bounds.Top + 1, colorSize, colorSize);
            graphics.DrawBox(colorBox, node.Value);
            graphics.DrawBox(new RectangleF(colorBox.X, colorBox.Y, 1, colorSize), Color.Black);
        }
Esempio n. 5
0
        public override void Render(Graphics graphics, MenuSettings settings)
        {
            if (!IsVisible)
            {
                return;
            }
            Color color = node.Value ? settings.EnabledBoxColor : settings.DisabledBoxColor;
            var textPosition = new Vector2(Bounds.X - 45 + Bounds.Width / 3, Bounds.Y + Bounds.Height / 2);
            if (key != null) graphics.DrawText(string.Concat("[", key, "]"), 12, Bounds.TopRight.Translate(-45, 0), settings.MenuFontColor);
            graphics.DrawText(Name, settings.MenuFontSize, textPosition, settings.MenuFontColor, FontDrawFlags.VerticalCenter | FontDrawFlags.Left);
            graphics.DrawImage("menu-background.png", new RectangleF(Bounds.X, Bounds.Y, Bounds.Width, Bounds.Height), settings.BackgroundColor);
            graphics.DrawImage("menu-slider.png", new RectangleF(Bounds.X + 5, Bounds.Y + 3 * Bounds.Height / 4 + 2, Bounds.Width - 10, 4), color);

            if (Children.Count > 0)
            {
                float width = (Bounds.Width - 2) * 0.08f;
                float height = (Bounds.Height - 2) / 2;
                var imgRect = new RectangleF(Bounds.X + Bounds.Width - 1 - width, Bounds.Y + 1 + height - height / 2, width, height);
                graphics.DrawImage("menu-arrow.png", imgRect);
            }
            Children.ForEach(x => x.Render(graphics, settings));
        }
Esempio n. 6
0
 public override void Render(Graphics graphics)
 {
     if (!IsVisible)
     {
         return;
     }
     Color color = node.Value ? Color.Gray : Color.Crimson;
     var textPosition = new Vector2(Bounds.X + Bounds.Width / 2, Bounds.Y + Bounds.Height / 2);
     if (key != null)
         graphics.DrawText(string.Concat("[",key,"]"), 11, Bounds.TopLeft.Translate(2, 2), Color.White);
     // TODO textSize to Settings
     graphics.DrawText(name, 20, textPosition, Color.White, FontDrawFlags.VerticalCenter | FontDrawFlags.Center);
     graphics.DrawBox(Bounds, Color.Black);
     graphics.DrawBox(new RectangleF(Bounds.X + 1, Bounds.Y + 1, Bounds.Width - 2, Bounds.Height - 2), color);
     if (Children.Count > 0)
     {
         float width = (Bounds.Width - 2) * 0.05f;
         float height = (Bounds.Height - 2) / 2;
         var imgRect = new RectangleF(Bounds.X + Bounds.Width - 3 - width, Bounds.Y + 1 + height - height / 2, width, height);
         graphics.DrawImage("menu_submenu.png", imgRect);
     }
     Children.ForEach(x => x.Render(graphics));
 }
Esempio n. 7
0
 public abstract void Render(Graphics graphics, MenuSettings settings);
Esempio n. 8
0
 public void Draw(Graphics graphics, RectangleF rectangle)
 {
     graphics.DrawImage(fileName, rectangle, color);
 }
Esempio n. 9
0
 public override void Render(Graphics graphics)
 {
     // TODO move to settings
     Color boxColor = Color.Gray;
     boxColor.A = 100;
     graphics.DrawBox(new RectangleF(Bounds.X, Bounds.Y, DesiredWidth, DesiredHeight), boxColor);
     var textColor = new ColorBGRA(255, 255, 255, 200);
     graphics.DrawText("Menu [F12]", 15, Bounds.TopLeft.Translate(40, 12), textColor, FontDrawFlags.VerticalCenter | FontDrawFlags.Center);
     Children.ForEach(x => x.Render(graphics));
 }
Esempio n. 10
0
 public override void Render(Graphics graphics, MenuSettings settings)
 {
     graphics.DrawText("Menu", settings.TitleFontSize, Bounds.TopLeft.Translate(25, 12), settings.TitleFontColor, FontDrawFlags.VerticalCenter | FontDrawFlags.Center);
     graphics.DrawImage("menu-background.png", Bounds, settings.BackgroundColor);
     Children.ForEach(x => x.Render(graphics, settings));
 }