Beispiel #1
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);
 }
Beispiel #2
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);
 }
Beispiel #3
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));
        }
Beispiel #4
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));
 }
Beispiel #5
0
 public void Draw(Graphics graphics, RectangleF rectangle)
 {
     graphics.DrawImage(fileName, rectangle, color);
 }
Beispiel #6
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));
 }