public virtual void RenderFrame() { // Dibujo un rectangulo int x0 = (int)(rc.Left + ox); int x1 = (int)(rc.Right + ox); int y0 = (int)(rc.Top + oy); int y1 = (int)(rc.Bottom + oy); if (sel) { int dmx = (int)(rc.Width * (k - 1) * 0.5); int dmy = (int)(rc.Height * (k - 1) * 0.5); gui.RoundRect(x0 - dmx, y0 - dmy, x1 + dmx, y1 + dmy, 4, 2, Color.FromArgb(gui.alpha, 0, 0, 0), true); } else if (state == itemState.pressed) { gui.RoundRect(x0, y0, x1, y1, 4, 2, Color.FromArgb(gui.alpha, 32, 140, 55)); float k2 = 1 + (float)(0.5 * gui.delay_press); int dmx = (int)(rc.Width * (k2 - 1) * 1.1); int dmy = (int)(rc.Height * (k2 - 1) * 1.1); gui.RoundRect(x0 - dmx, y0 - dmy, x1 + dmx, y1 + dmy, 4, 8, Color.FromArgb(gui.alpha, 255, 0, 0)); } else { gui.RoundRect(x0, y0, x1, y1, 4, 2, Color.FromArgb(gui.alpha, 32, 140, 55)); } }
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); }
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)); }
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(); } } }
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); }
public virtual void Render(DXGui gui) { bool sel = gui.sel == nro_item && !disabled ? true : false; Color color = sel ? c_selected : c_font; if (rc.Width == 0 || rc.Height == 0) { // Ajusta el rectangulo para que adapte al texto a dibujar Rectangle tw = gui.font.MeasureString(gui.sprite, text, DrawTextFormat.NoClip | DrawTextFormat.Top, color); rc.Width = tw.Width + 20; rc.Height = tw.Height + 10; rc.X -= 10; rc.Y -= 5; // Recalcula el centro center = new Point(rc.X + rc.Width / 2, rc.Y + rc.Height / 2); } Texture tx = sel && textura_sel != null ? textura_sel : textura; if (tx != null) { TGCVector3 pos = image_centrada ? new TGCVector3(rc.X - image_width, rc.Y + (rc.Height - image_height) / 2, 0) : new TGCVector3(rc.X, rc.Y, 0); gui.sprite.Draw(tx, Rectangle.Empty, TGCVector3.Empty, pos, Color.FromArgb(gui.alpha, 255, 255, 255)); } if (sel) { gui.RoundRect(rc.Left - 8, rc.Top - 6, rc.Right + 8, rc.Bottom + 6, 6, 3, Color.FromArgb(gui.alpha, DXGui.c_selected_frame), false); int dy = rc.Height / 2; gui.line.Width = 2f; gui.line.Begin(); byte r0 = DXGui.c_grad_inf_0.R; byte g0 = DXGui.c_grad_inf_0.G; byte b0 = DXGui.c_grad_inf_0.B; byte r1 = DXGui.c_grad_inf_1.R; byte g1 = DXGui.c_grad_inf_1.G; byte b1 = DXGui.c_grad_inf_1.B; // Gradiente de abajo for (int i = 0; i < dy; ++i) { TGCVector2[] pt = new TGCVector2[2]; pt[0].X = rc.X - 3; pt[1].X = rc.X + rc.Width + 3; pt[1].Y = pt[0].Y = rc.Y + rc.Height / 2 - i; gui.Transform(pt, 2); float t = i / (float)dy; byte r = (byte)(r0 * t + r1 * (1 - t)); byte g = (byte)(g0 * t + g1 * (1 - t)); byte b = (byte)(b0 * t + b1 * (1 - t)); gui.line.Draw(TGCVector2.ToVector2Array(pt), Color.FromArgb(gui.alpha, r, g, b)); } // Gradiente de arriba r0 = DXGui.c_grad_sup_0.R; g0 = DXGui.c_grad_sup_0.G; b0 = DXGui.c_grad_sup_0.B; r1 = DXGui.c_grad_sup_1.R; g1 = DXGui.c_grad_sup_1.G; b1 = DXGui.c_grad_sup_1.B; for (int i = 0; i < dy; ++i) { TGCVector2[] pt = new TGCVector2[2]; pt[0].X = rc.X - 3; pt[1].X = rc.X + rc.Width + 3; pt[1].Y = pt[0].Y = rc.Y + rc.Height / 2 + i; gui.Transform(pt, 2); float t = i / (float)dy; byte r = (byte)(r0 * t + r1 * (1 - t)); byte g = (byte)(g0 * t + g1 * (1 - t)); byte b = (byte)(b0 * t + b1 * (1 - t)); gui.line.Draw(TGCVector2.ToVector2Array(pt), Color.FromArgb(gui.alpha, r, g, b)); } gui.line.End(); } // dibujo el texto pp dicho gui.font.DrawText(gui.sprite, text, rc, DrawTextFormat.NoClip | DrawTextFormat.VerticalCenter, disabled ? Color.FromArgb(gui.alpha, DXGui.c_item_disabled) : sel ? Color.FromArgb(gui.alpha, 0, 32, 128) : c_font); }