示例#1
0
        // custom draw del menu item
        public override void Render(DXGui gui)
        {
            bool sel = gui.sel == nro_item ? true : false;

            gui.DrawLine(rc.Left, rc.Bottom, rc.Left + 30, rc.Top, 5, Color.FromArgb(81, 100, 100));
            gui.DrawLine(rc.Left + 30, rc.Top, rc.Right, rc.Top, 5, Color.FromArgb(81, 100, 100));

            if (sel)
            {
                // boton seleccionado: lleno el interior
                Vector2 [] p = new Vector2[20];
                p[0].X = rc.Left;
                p[0].Y = rc.Bottom;
                p[1].X = rc.Left + 30;
                p[1].Y = rc.Top;
                p[2].X = rc.Right;
                p[2].Y = rc.Top;
                p[3].X = rc.Right;
                p[3].Y = rc.Bottom;
                p[4].X = rc.Left;
                p[4].Y = rc.Bottom;
                p[5]   = p[0];
                gui.DrawGradientPoly(p, 6, Color.White, Color.FromArgb(35, 56, 68));

                // solo si esta seleccionado (hightlighted) muestro la imagen en un lugar fijo
                if (textura != null)
                {
                    gui.sprite.Draw(textura, Rectangle.Empty, Vector3.Empty, pos_imagen,
                                    Color.FromArgb(gui.alpha, 255, 255, 255));
                }
            }
            // Texto del boton
            Rectangle rc2 = new Rectangle(rc.Left + 40, rc.Top + 3, rc.Width, rc.Height - 3);

            font.DrawText(gui.sprite, text, rc2, DrawTextFormat.VerticalCenter | DrawTextFormat.Left, Color.WhiteSmoke);
        }
示例#2
0
        // custom draw del menu item
        public override void Render(DXGui gui)
        {
            bool sel = gui.sel == nro_item ? true : false;

            float rx = rc.Height / 2;
            float ry = rc.Height / 2;
            float x0 = rc.Left + rx;
            float y0 = rc.Top + ry;

            if (sel)
            {
                rx += 12;
                ry += 12;
                x0 -= 6;
                y0 -= 6;
            }

            Vector2[] p = new Vector2[20];
            p[0].X = rc.Left + 50;
            p[0].Y = rc.Bottom - 15;
            p[1].X = rc.Left + 50;
            p[1].Y = rc.Top + 15;
            p[2].X = rc.Right;
            p[2].Y = rc.Top + 15;
            p[3].X = rc.Right;
            p[3].Y = rc.Bottom - 15;
            p[4].X = rc.Left + 50;
            p[4].Y = rc.Bottom - 15;
            p[5]   = p[0];

            if (sel)
            {
                gui.DrawGradientPoly(p, 6, Color.White, Color.FromArgb(35, 56, 68));
            }
            else
            {
                gui.DrawSolidPoly(p, 6, Color.FromArgb(42, 71, 90), false);
                gui.DrawPoly(p, 6, 1, Color.FromArgb(50, 75, 240));
            }


            Vector2[] Q = new Vector2[7];
            for (int i = 0; i < 6; ++i)
            {
                Q[i].X = (float)(x0 + rx * Math.Cos(2 * Math.PI / 6 * i));
                Q[i].Y = (float)(y0 + ry * Math.Sin(2 * Math.PI / 6 * i));
            }
            Q[6] = Q[0];

            gui.DrawSolidPoly(Q, 7, c_fondo, false);

            if (sel)
            {
                // boton seleccionado: lleno el interior
                gui.DrawPoly(Q, 7, 4, DXGui.c_buttom_selected);
            }
            else
            {
                gui.DrawPoly(Q, 7, 2, Color.FromArgb(61, 96, 100));
            }


            if (textura != null)
            {
                gui.sprite.Draw(textura, Rectangle.Empty, Vector3.Empty,
                                new Vector3(x0 - image_width / 2, y0 - image_height / 2, 0),
                                Color.FromArgb(gui.alpha, 255, 255, 255));
            }

            // Texto del boton
            Rectangle rc2 = new Rectangle(rc.Left + 90, rc.Top + 3, rc.Width, rc.Height - 3);

            font.DrawText(gui.sprite, text, rc2, DrawTextFormat.VerticalCenter | DrawTextFormat.Left,
                          sel ? Color.Black : Color.WhiteSmoke);
        }