Exemple #1
0
 public gui_frame(DXGui gui, String s, int x, int y, int dx, int dy, Color color,
                  frameBorder tipo_borde = frameBorder.rectangular)  :
     base(gui, s, x, y, dx, dy)
 {
     c_fondo = color;
     borde   = tipo_borde;
 }
Exemple #2
0
 public gui_button(DXGui gui, Color customColor, string s, int id, int x, int y, int dx = 0, int dy = 0) :
     base(gui, s, x, y, dx, dy, id)
 {
     seleccionable        = true;
     this.customColor     = customColor;
     customColorSpecified = true;
 }
Exemple #3
0
        public override void Render(DXGui gui)
        {
            bool  sel   = gui.sel == nro_item ? true : false;
            Color color = sel ? Color.FromArgb(gui.alpha, 255, 220, 220) : Color.FromArgb(gui.alpha, 130, 255, 130);

            gui.RoundRect(rc.Left, rc.Top, rc.Right, rc.Bottom, radio, 2, color, false);
        }
Exemple #4
0
        /// <summary>
        /// Dialog que muestra todas las categorias de texturas disponibles que hay.
        /// Al hacer clic te abre un segundo Dialog con las texturas dentro de esa categoria.
        /// </summary>
        public void TextureGroupDlg(DXGui gui)
        {
            // Inicio un dialogo modalless
            gui.InitDialog(false, false);

            int W = GuiController.Instance.Panel3d.Width;
            int H = GuiController.Instance.Panel3d.Height;

            int x0 = 20;
            int y0 = 50;
            int dy = 500;
            int dx = W - 40;
            int r  = 250;

            gui.InsertFrame("Seleccione la categoría", x0, y0, dx, dy, Color.FromArgb(192, 192, 192), frameBorder.redondeado);

            //int sdx = 400;
            //int sdy = 120;
            //gui.InsertKinectScrollButton(0, "scroll_left.png", x0 + 40, y0 + dy - sdy - 50, sdx, sdy);
            //gui.InsertKinectScrollButton(1, "scroll_right.png", x0 + 40 + sdx + 20, y0 + dy - sdy - 50, sdx, sdy);
            gui_item cancel_btn = gui.InsertKinectCircleButton(1, "Cancel", "cancel.png", W - gui.KINECT_BUTTON_SIZE_X - 40,
                                                               y0 + 20, gui.KINECT_BUTTON_SIZE_X);

            cancel_btn.scrolleable = false;      // fijo el boton de cancelar

            //Crear un boton por cada grupo de textura
            for (int i = 0; i < grupos.Count; i++)
            {
                Group g = grupos[i];
                gui.InsertKinectCircleButton(g.guiId, g.name, g.iconPath, x0 + 50 + i * (r + 20), y0 + 160, r);
            }
        }
Exemple #5
0
 public gui_progress_bar(DXGui gui, int x, int y, int dx, int dy, int id = -1) :
     base(gui, "", x, y, dx, dy, id)
 {
     pos           = desde = 1;
     hasta         = 100;
     seleccionable = false;
 }
Exemple #6
0
 public gui_menu_item(DXGui gui, string s, string imagen, int id, int x, int y, string mediaDir, int dx = 0, int dy = 0, bool penabled = true) :
     base(gui, s, x, y, dx, dy, id)
 {
     disabled      = !penabled;
     seleccionable = true;
     cargar_textura(imagen, mediaDir);
 }
Exemple #7
0
        public override void Render(DXGui gui)
        {
            bool sel = gui.sel == nro_item ? true : false;

            if (textura != null)
            {
                TGCVector3 pos = new TGCVector3(rc.Left - 64, rc.Top - 8, 0);
                gui.sprite.Draw(textura, Rectangle.Empty, TGCVector3.Empty, pos, Color.FromArgb(gui.alpha, 255, 255, 255));
            }

            // recuadro del boton
            gui.RoundRect(rc.Left, rc.Top, rc.Right, rc.Bottom, 15, 3, DXGui.c_buttom_frame);

            if (sel)
            {
                // boton seleccionado: lleno el interior
                gui.RoundRect(rc.Left, rc.Top, rc.Right, rc.Bottom, 10, 1, DXGui.c_buttom_selected, true);
            }

            // Texto del boton
            Rectangle rc2   = new Rectangle(rc.Left, rc.Top + 10, rc.Width, rc.Height - 20);
            Color     color = sel ? DXGui.c_buttom_sel_text : DXGui.c_buttom_text;

            gui.font.DrawText(gui.sprite, text, rc, DrawTextFormat.VerticalCenter | DrawTextFormat.Center, color);
        }
Exemple #8
0
        public override void Render(DXGui gui)
        {
            bool sel = gui.sel == nro_item ? true : false;
            Color clr = Color.FromArgb(Math.Min(gui.alpha, c_fondo.A), c_fondo);
            switch (borde)
            {
                case frameBorder.sin_borde:
                    // dibujo solo interior
                    gui.DrawRect(rc.X, rc.Y, rc.X + rc.Width, rc.Y + rc.Height, 1, clr, true);
                    break;

                case frameBorder.redondeado:
                    // Interior
                    gui.RoundRect(rc.X, rc.Y, rc.X + rc.Width, rc.Y + rc.Height, 30, 6, clr, true);
                    // Contorno
                    gui.RoundRect(rc.X, rc.Y, rc.X + rc.Width, rc.Y + rc.Height, 30, 6, Color.FromArgb(gui.alpha, DXGui.c_frame_border));
                    break;

                case frameBorder.solapa:
                    {
                        float r = 40;
                        TGCVector2[] pt = new TGCVector2[10];
                        pt[0].X = rc.X;
                        pt[0].Y = rc.Y + rc.Height;
                        pt[1].X = rc.X;
                        pt[1].Y = rc.Y;
                        pt[2].X = rc.X + rc.Width - r;
                        pt[2].Y = rc.Y;
                        pt[3].X = rc.X + rc.Width;
                        pt[3].Y = rc.Y + r;
                        pt[4].X = rc.X + rc.Width;
                        pt[4].Y = rc.Y + rc.Height;
                        pt[5].X = rc.X;
                        pt[5].Y = rc.Y + rc.Height;
                        pt[6] = pt[0];

                        gui.DrawSolidPoly(pt, 7, clr, false);
                        gui.DrawPoly(pt, 5, 6, DXGui.c_frame_border);
                    }

                    break;

                case frameBorder.rectangular:
                default:

                    // interior
                    gui.DrawRect(rc.X, rc.Y, rc.X + rc.Width, rc.Y + rc.Height, 1, Color.FromArgb(gui.alpha, c_fondo), true);
                    // contorno
                    gui.DrawRect(rc.X, rc.Y, rc.X + rc.Width, rc.Y + rc.Height, 6, Color.FromArgb(gui.alpha, DXGui.c_frame_border));
                    break;
            }

            // Texto del frame
            Rectangle rc2 = new Rectangle(rc.X, rc.Y, rc.X + rc.Width, rc.Y + rc.Height);
            rc2.Y += 30;
            rc2.X += 30;
            Color color = sel ? c_selected : c_font;
            gui.font.DrawText(gui.sprite, text, rc2, DrawTextFormat.NoClip | DrawTextFormat.Top, Color.FromArgb(gui.alpha, color));
        }
Exemple #9
0
 public menu_item2(DXGui gui, String s, String imagen, int id, int x, int y, int dx = 0, int dy = 0, bool penabled = true) :
     base(gui, s, x, y, dx, dy, id)
 {
     disabled      = !penabled;
     seleccionable = true;
     cargar_textura(imagen);
     font = gui.font_medium;
 }
Exemple #10
0
        public override void Render(DXGui gui)
        {
            Device d3dDevice    = GuiController.Instance.D3dDevice;
            float  W            = (float)GuiController.Instance.Panel3d.Width;
            float  H            = (float)GuiController.Instance.Panel3d.Height;
            float  aspect_ratio = W / H;

            // pongo la matriz identidad
            Matrix matAnt = gui.sprite.Transform * Matrix.Identity;

            gui.sprite.Transform = Matrix.Identity;

            float ant_ox = gui.ox;
            float ant_oy = gui.oy;

            gui.oy = gui.ox = 0;
            bool ant_trap = gui.trapezoidal_style;

            gui.trapezoidal_style = false;

            gui.DrawRect(rc.Left, rc.Top, rc.Right, rc.Bottom, 1, Color.FromArgb(0, 0, 0), true);

            Rectangle rc2 = new Rectangle(rc.Left + margen, rc.Top + margen, rc.Width - 2 * +margen, rc.Height - 2 * +margen);

            // Dibujo los huesos
            for (int t = 0; t < cant_huesos; ++t)
            {
                int   i  = hueso_desde[t];
                int   j  = hueso_hasta[t];
                float x0 = (joints[i].X - min_x) * escala + rc2.X;
                float y0 = rc2.Y + rc2.Height - (joints[i].Y - min_y) * escala;
                float x1 = (joints[j].X - min_x) * escala + rc2.X;
                float y1 = rc2.Y + rc2.Height - (joints[j].Y - min_y) * escala;
                gui.DrawLine(x0, y0, x1, y1, 3, Color.Blue);
            }

            // Dibujo las articulaciones
            for (int i = 0; i < cant_joints; ++i)
            {
                float x = (joints[i].X - min_x) * escala + rc2.X;
                float y = rc2.Y + rc2.Height - (joints[i].Y - min_y) * escala;
                int   r = importante[i] ? 4 : 2;
                gui.DrawRect((int)x - r, (int)y - r, (int)x + r, (int)y + r, 1, Color.WhiteSmoke, true);
            }

            // Area de interaccion fisica de la kinect
            gui.DrawRect((int)((-pir_min_x + head_pos.X - min_x) * escala + rc2.X),
                         (int)(rc2.Y + rc2.Height - (-pir_min_y + head_pos.Y - min_y) * escala),
                         (int)((-pir_max_x + head_pos.X - min_x) * escala + rc2.X),
                         (int)(rc2.Y + rc2.Height - (-pir_max_y + head_pos.Y - min_y) * escala),
                         1, Color.FromArgb(100, 240, 255, 120), true);

            gui.ox = ant_ox;
            gui.oy = ant_oy;
            gui.trapezoidal_style = ant_trap;
            // Restauro la transformacion del sprite
            gui.sprite.Transform = matAnt;
        }
Exemple #11
0
 // interface:
 public bool pt_inside(DXGui gui, Point p)
 {
     TGCVector2[] Q = new TGCVector2[2];
     Q[0] = new TGCVector2(rc.X, rc.Y);
     Q[1] = new TGCVector2(rc.X + rc.Width, rc.Y + rc.Height);
     gui.Transform(Q, 2);
     Rectangle r = new Rectangle((int)Q[0].X, (int)Q[0].Y, (int)(Q[1].X - Q[0].X), (int)(Q[1].Y - Q[0].Y));
     return r.Contains(p);
 }
Exemple #12
0
 public gui_tile_button(DXGui gui, string s, string imagen, int id, int x, int y, string mediaDir, int dx, int dy, bool bscrolleable = true) :
     base(gui, s, x, y, dx, dy, id)
 {
     seleccionable = true;
     scrolleable   = bscrolleable;
     border        = true;
     // Cargo la imagen en el gui
     cargar_textura(imagen, mediaDir);
 }
Exemple #13
0
 public GUIItem(DXGui gui, string s, int x, int y, int dx = 0, int dy = 0, int id = -1)
 {
     Clean();
     item_id  = id;
     nro_item = gui.cant_items;
     font     = gui.font;
     text     = s;
     rc       = new Rectangle(x, y, dx, dy);
     center   = new Point(x + dx / 2, y + dy / 2);
     len      = s.Length;
 }
Exemple #14
0
        public override void Render(DXGui gui)
        {
            float k = (float)(pos - desde) / (float)(hasta - desde);
            gui.DrawRect(rc.Left, rc.Top, rc.Right, rc.Bottom, 1, Color.FromArgb(240, 240, 240), true);
            gui.DrawRect(rc.Left, rc.Top, rc.Right, rc.Bottom, 1, Color.FromArgb(0, 0, 0));
            gui.DrawRect(rc.Left, rc.Top, rc.Left + (int)(rc.Width * k), rc.Bottom, 1, Color.FromArgb(0, 100, 255), true);
            gui.DrawRect(rc.Left, rc.Top, rc.Left + (int)(rc.Width * k), rc.Bottom, 1, Color.FromArgb(0, 0, 0));

            Rectangle rc2 = new Rectangle(rc.Left, rc.Top - 50, rc.Width, 50);
            gui.font.DrawText(gui.sprite, text, rc2, DrawTextFormat.NoClip | DrawTextFormat.Top, Color.FromArgb(0, 0, 0));
        }
Exemple #15
0
 public void cargar_textura(String imagen)
 {
     // Cargo la imagen en el gui
     if ((textura = DXGui.cargar_textura(imagen, true)) != null)
     {
         // Aprovecho para calcular el tamaño de la imagen del boton
         SurfaceDescription desc = textura.GetLevelDescription(0);
         image_width  = desc.Width;
         image_height = desc.Height;
     }
 }
Exemple #16
0
        public kinect_input(DXGui p_gui)
        {
            gui = p_gui;

            left_hand.position = new Vector3(0, 0, 0);
            left_hand.gripping = false;
            left_hand.visible  = true;

            right_hand.position = new Vector3(0, 0, 0);
            right_hand.gripping = false;
            right_hand.visible  = true;
        }
Exemple #17
0
        public gui_navigate(DXGui gui, List <TgcMesh> p_meshes, int x, int y, int dx = 0, int dy = 0, int id = -1) :
            base(gui, "", x, y, dx, dy, id)
        {
            seleccionable = false;
            scrolleable   = false;
            modo_pan      = false;
            // Calculo el bounding box de la escena
            float x0 = 10000;
            float z0 = 10000;
            float x1 = -10000;
            float z1 = -10000;

            if (p_meshes != null)
            {
                foreach (TgcMesh m in p_meshes)
                {
                    TgcBoundingBox box = m.BoundingBox;
                    if (box.PMin.X < x0)
                    {
                        x0 = box.PMin.X;
                    }
                    if (box.PMin.Z < z0)
                    {
                        z0 = box.PMin.Z;
                    }
                    if (box.PMax.X > x1)
                    {
                        x1 = box.PMax.X;
                    }
                    if (box.PMax.Z > z1)
                    {
                        z1 = box.PMax.Z;
                    }
                }
            }

            min_x = x0;
            min_z = z0;
            wdx   = x1 - x0;
            wdz   = z1 - z0;

            // Calculo la escala de toda la cocina
            ex = (float)rc.Width / wdx;
            ey = (float)rc.Height / wdz;
            if (ex < ey)
            {
                ey = ex;
            }
            else
            {
                ex = ey;
            }
        }
        public override void Render(DXGui gui)
        {
            bool sel  = gui.sel == nro_item ? true : false;
            bool foco = gui.foco == nro_item ? true : false;

            // recuadro del edit
            gui.RoundRect(rc.Left, rc.Top, rc.Right, rc.Bottom, 11, 2, Color.FromArgb(80, 220, 20));

            if (foco)
            {
                // tiene foco
                gui.RoundRect(rc.Left, rc.Top, rc.Right, rc.Bottom, 8, 1, Color.FromArgb(255, 255, 255, 255), true);
            }

            // Texto del edit
            Color color = foco ? Color.FromArgb(0, 0, 0) : Color.FromArgb(130, 255, 130);

            gui.font.DrawText(gui.sprite, text, rc, DrawTextFormat.Top | DrawTextFormat.Left, color);

            if (foco)
            {
                // si esta vacio, le agrego una I para que cuente bien el alto del caracter
                string p = text;
                if (p.Length == 0)
                {
                    p += "I";
                }

                Rectangle tw = new Rectangle();
                int       h  = gui.font.DrawText(gui.sprite, p, tw, DrawTextFormat.Top | DrawTextFormat.NoClip, color);

                //Rectangle tw = gui.font.MeasureString(gui.sprite, p, DrawTextFormat.Top | DrawTextFormat.NoClip, color);


                Rectangle rc2 = new Rectangle(rc.Right + tw.Width, rc.Top, 12, rc.Height);
                // dibujo el cursor titilando
                int cursor = (int)(gui.time * 5);
                if (cursor % 2 != 0)
                {
                    gui.line.Width = 8;
                    TGCVector2[] pt = new TGCVector2[2];
                    pt[0].X = rc2.Left;
                    pt[1].X = rc2.Right;
                    pt[1].Y = pt[0].Y = rc2.Bottom;

                    gui.Transform(pt, 2);
                    gui.line.Begin();
                    gui.line.Draw(TGCVector2.ToVector2Array(pt), Color.FromArgb(0, 64, 0));
                    gui.line.End();
                }
            }
        }
Exemple #19
0
        public gui_mesh_button(DXGui gui, String s, String fname, int id, int x, int y, int dx, int dy) :
            base(gui, s, x, y, dx, dy, id)
        {
            YParser yparser = new YParser();

            yparser.FromFile(fname);
            mesh = yparser.Mesh;

            mesh.AutoTransformEnable = false;
            size          = mesh.BoundingBox.calculateSize();
            seleccionable = true;
            item3d        = true;
        }
Exemple #20
0
        public void cargar_textura(string imagen, string mediaDir)
        {
            // Cargo la imagen en el gui
            if ((textura = DXGui.cargar_textura(imagen, mediaDir, true)) != null)
            {
                // Aprovecho para calcular el tamaño de la imagen del boton
                SurfaceDescription desc = textura.GetLevelDescription(0);
                image_width  = desc.Width;
                image_height = desc.Height;
            }

            // x defecto la imagen seleccionada tiene el mismo nombre con el S_ al principio
            textura_sel = DXGui.cargar_textura("S_" + imagen, mediaDir, true);
        }
Exemple #21
0
 public override void Render(DXGui gui)
 {
     // Guardo la TGCMatrix anterior
     TGCMatrix matAnt = TGCMatrix.FromMatrix(gui.sprite.Transform) * TGCMatrix.Identity;
     // Inicializo escalas, matrices, estados
     InitRender(gui);
     // Secuencia standard: texto + Frame + Glyph
     RenderText();
     if (border)
         RenderFrame();
     RenderGlyph();
     // Restauro la transformacion del sprite
     gui.sprite.Transform = matAnt;
 }
Exemple #22
0
        /// <summary>
        /// Dialog que muestra todas las texturas dentro de una categoria especifica.
        /// Al seleccionar una textura la aplica a todos los mesh que tenga esa categoria
        /// </summary>
        public void TextureDlg(DXGui gui, int groupId)
        {
            // Inicio un dialogo modalless
            gui.InitDialog(false, false);

            int W = GuiController.Instance.Panel3d.Width;
            int H = GuiController.Instance.Panel3d.Height;

            int x0  = -20;
            int y0  = 0;
            int dy  = 520;
            int dx  = W + 40;
            int tdx = 250;
            int tdy = 200;

            gui.InsertFrame("Seleccione la textura", x0, y0, dx, dy, Color.FromArgb(192, 192, 192), frameBorder.sin_borde);
            int sdx = 500;
            int sdy = 120;

            gui.InsertKinectScrollButton(0, "scroll_left.png", x0 + 40, y0 + dy - sdy - 50, sdx, sdy);
            gui.InsertKinectScrollButton(1, "scroll_right.png", x0 + 40 + sdx + 20, y0 + dy - sdy - 50, sdx, sdy);
            gui_item cancel_btn = gui.InsertKinectCircleButton(1, "Cancel", "cancel.png", W - gui.KINECT_BUTTON_SIZE_X - 40,
                                                               y0 + dy - gui.KINECT_BUTTON_SIZE_X - 50, gui.KINECT_BUTTON_SIZE_X);

            cancel_btn.scrolleable = false;      // fijo el boton de cancelar

            //Buscar grupo con ese id de gui
            selectedGroup = null;
            foreach (Group g in grupos)
            {
                if (g.guiId == groupId)
                {
                    selectedGroup = g;
                    break;
                }
            }


            //Crear un boton por cada textura dentro de este grupo
            for (int i = 0; i < selectedGroup.textures.Count; i++)
            {
                Texture t = selectedGroup.textures[i];
                gui.InsertKinectTileButton(t.guiId, (i + 1).ToString(), t.path, x0 + 50 + i * (tdx + 50), y0 + 100, tdx, tdy);
            }
        }
Exemple #23
0
        public override void Render(DXGui gui)
        {
            bool sel = gui.sel == nro_item ? true : false;

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

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

            TGCVector2[] Q = new TGCVector2[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
            if (marcado)
            {
                gui.DrawPoly(Q, 7, 3, Color.FromArgb(240, 245, 245));
            }
            else
            {
                gui.DrawPoly(Q, 7, 1, Color.FromArgb(120, 120, 64));
            }
        }
Exemple #24
0
        public virtual void InitRender(DXGui p_gui)
        {
            // inicializacion comun a todos los controles
            gui = p_gui;

            // estado del control
            sel = state == itemState.hover;

            // Calcula la escala pp dicha
            ex = gui.ex;
            ey = gui.ey;
            ox = gui.ox;
            oy = gui.oy;
            if (scrolleable)
            {
                // como este boton es un item scrolleable, tiene que aplicar tambien el origen sox,soy
                ox += gui.sox;
                oy += gui.soy;
            }

            // sobre escala por estar seleccionado
            k = 1;
            if (sel)
            {
                // aumento las escala
                k = 1 + (float)(0.5 * (gui.delay_sel0 - gui.delay_sel));

                // Le aplico una matriz de escalado adicional, solo sobre el TEXTO.
                // El glyph tiene su propia matriz

                // Este kilombo es porque una cosa es la escala global que se aplica uniformemente en todo el gui
                // y esta centrada en el origen.
                // Pero esta escala es local, del texto, que se aplica centra en centro del texto, luego de haberlo
                // escalado por la escala global.
                gui.sprite.Transform = gui.sprite.Transform * TGCMatrix.Transformation2D(new TGCVector2((center.X + ox) * ex, (center.Y + oy) * ey), 0, new TGCVector2(k, k),
                                                                                         TGCVector2.Zero, 0, TGCVector2.Zero);
            }
        }
Exemple #25
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);
        }
Exemple #26
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);
        }
Exemple #27
0
 // custom draw
 public override void Render(DXGui gui)
 {
     gui.font.DrawText(gui.sprite, text, rc, DrawTextFormat.Left, Color.WhiteSmoke);
     gui.DrawLine(rc.Left, rc.Bottom, rc.Right, rc.Bottom, 6, Color.FromArgb(131, 108, 34));
     gui.DrawLine(rc.Left, rc.Bottom - 2, rc.Right, rc.Bottom - 2, 2, Color.FromArgb(255, 240, 134));
 }
Exemple #28
0
 public static_text(DXGui gui, String s, int x, int y, int dx = 0, int dy = 0) :
     base(gui, s, x, y, dx, dy, -1)
 {
     disabled      = false;
     seleccionable = false;
 }
Exemple #29
0
        public gui_circle_button(DXGui gui, string s, string imagen, int id, int x, int y, string mediaDir, int r) :
            base(gui, s, imagen, id, x, y, mediaDir, r, r)

        {
            texto_derecha = false;              // indica si el texto va a derecha o debajo del glyph
        }
Exemple #30
0
        public override void Render(DXGui gui)
        {
            bool sel = gui.sel == nro_item ? true : false;

            float M_PI = (float)Math.PI;

            TGCVector2[] pt = new TGCVector2[255];
            float        da = M_PI / 8;
            float        alfa;

            float x0 = rc.Left;
            float x1 = rc.Right;
            float y0 = rc.Top;
            float y1 = rc.Bottom;
            float r  = 10;
            int   t  = 0;
            float x  = x0;
            float y  = y0;

            for (alfa = 0; alfa < M_PI / 2; alfa += da)
            {
                pt[t].X = (float)(x - r * Math.Cos(alfa));
                pt[t].Y = (float)(y - r * Math.Sin(alfa));
                ++t;
            }
            pt[t].X = x;
            pt[t].Y = y - r;
            ++t;

            pt[t].X = (x1 + x0) / 2;
            pt[t].Y = y - r;
            ++t;
            pt[t].X = (x1 + x0) / 2 + 50;
            pt[t].Y = y + 20 - r;
            ++t;

            x = x1;
            y = y0 + 20;
            for (alfa = M_PI / 2; alfa < M_PI; alfa += da)
            {
                pt[t].X = (float)(x - r * Math.Cos(alfa));
                pt[t].Y = (float)(y - r * Math.Sin(alfa));
                ++t;
            }
            pt[t].X = x + r;
            pt[t].Y = y;
            ++t;

            x = x1;
            y = y1;
            for (alfa = 0; alfa < M_PI / 2; alfa += da)
            {
                pt[t].X = (float)(x + r * Math.Cos(alfa));
                pt[t].Y = (float)(y + r * Math.Sin(alfa));
                ++t;
            }
            pt[t].X = x;
            pt[t].Y = y + r;
            ++t;

            pt[t].X = x0 + 150;
            pt[t].Y = y + r;

            ++t;
            pt[t].X = x0 + 100;
            pt[t].Y = y - 20 + r;
            ++t;

            x = x0;
            y = y - 20;
            for (alfa = M_PI / 2; alfa < M_PI; alfa += da)
            {
                pt[t].X = (float)(x + r * Math.Cos(alfa));
                pt[t].Y = (float)(y + r * Math.Sin(alfa));
                ++t;
            }
            pt[t++] = pt[0];

            // interior
            gui.DrawSolidPoly(pt, t, c_fondo);

            // contorno
            gui.DrawPoly(pt, t, 6, DXGui.c_frame_border);

            // Texto del frame
            Rectangle rc2 = new Rectangle(rc.Top, rc.Left, rc.Width, rc.Height);

            rc2.Y += 25;
            rc2.X += 30;
            Color color = sel ? c_selected : c_font;

            gui.font.DrawText(gui.sprite, text, rc2, DrawTextFormat.NoClip | DrawTextFormat.Top, color);
        }