public DialogoPrueba() : base(new Size(500, 550)) { Title = "Prueba"; BackColor = Color.FromArgb(240, Color.DarkGreen); TitleColor = Color.FromArgb(240, Color.Green); GUICheckbox guiChk = new GUICheckbox(new Size(100, 24)); guiChk.Text = "Checkbox"; AddChildWindow(guiChk, new Point(5, 30)); GUIHorizontalComboBox guiHCB = new GUIHorizontalComboBox(new Size(100, 24), new object[] { "Opcion A", "Opcion B", "Opcion C" }); AddChildWindow(guiHCB, new Point(5, 50)); Focus = guiHCB; GUIButton guiBtn1 = new GUIButton(new Size(30, 24)); guiBtn1.Text = "BTN1"; AddChildWindow(guiBtn1, new Point(5, 80)); GUIButton guiBtn2 = new GUIButton(new Size(30, 24)); guiBtn2.Text = "BTN2"; AddChildWindow(guiBtn2, new Point(40, 80)); guiBtn1.ButtonPressed += new GUIButton.ButtonPressedHandler(guiBtn1_ButtonPressed); }
public void AddLabledCheckbox(string labelText, bool checkboxDefaultState, UDim2 position, out GUILabel label, out GUICheckbox checkbox) { label = new GUILabel(position, UDim2.Zero, labelText, TextAlign.Left, Theme); Vector2 textSize = label.Font.MeasureString(labelText); label.Size = new UDim2(0, textSize.X, 0, textSize.Y + (ElementPadding * 2)); UDim labelXPos = position.X + new UDim(0, textSize.X + ElementPadding); checkbox = new GUICheckbox(new UDim2(labelXPos, position.Y), label.Size.Y.Offset, Theme); checkbox.IsChecked = checkboxDefaultState; label.Parent = this; checkbox.Parent = this; }
public DialogoConfiguracion() : base(new Size(500, 400)) { Title = "Configuracion"; BackColor = Color.FromArgb(240, Color.DarkBlue); TitleColor = Color.FromArgb(240, Color.Blue); GUIStatic st; int y = 5; //Resolucion st = new GUIStatic(new Size(1, 1)); st.Text = "--------------------------- Pantalla ---------------------------"; AddDialogChildWindow(st, new Point(5, y)); y += 30; //Resolucion st = new GUIStatic(new Size(1, 1)); st.Text = "Resolución: "; AddDialogChildWindow(st, new Point(5, y)); Sdl.SDL_Rect[] resoluciones = Sdl.SDL_ListModes(IntPtr.Zero, Sdl.SDL_HWSURFACE | Sdl.SDL_DOUBLEBUF | Sdl.SDL_OPENGL | Sdl.SDL_FULLSCREEN); System.Collections.ArrayList arrResoluciones = new System.Collections.ArrayList(); foreach (Sdl.SDL_Rect res in resoluciones) { arrResoluciones.Add(new Resolucion(new Size(res.w, res.h))); } guiResolucion = new GUIHorizontalComboBox(new Size(InnerBounds.Width / 2 - 10, 24), (object[])arrResoluciones.ToArray()); AddDialogChildWindow(guiResolucion, new Point(5 + InnerBounds.Width / 2, y)); y += 30; //Profunidad Bits st = new GUIStatic(new Size(1, 1)); st.Text = "Bits de Color: "; AddDialogChildWindow(st, new Point(5, y)); guiBitsDeColor = new GUIHorizontalComboBox(new Size(InnerBounds.Width / 2 - 10, 24), new object[] { 16, 32 }); AddDialogChildWindow(guiBitsDeColor, new Point(5 + InnerBounds.Width / 2, y)); y += 30; //Pantalla completa st = new GUIStatic(new Size(1, 1)); st.Text = "Pantalla Completa: "; AddDialogChildWindow(st, new Point(5, y)); guiPantallaCompleta = new GUICheckbox(new Size(InnerBounds.Width / 2 - 10, 24)); AddDialogChildWindow(guiPantallaCompleta, new Point(5 + InnerBounds.Width / 2, y)); y += 30; //Controles st = new GUIStatic(new Size(1, 1)); st.Text = "--------------------------- Controles --------------------------"; AddDialogChildWindow(st, new Point(5, y)); y += 30; //Forma de Control st = new GUIStatic(new Size(1, 1)); st.Text = "Forma de Control: "; AddDialogChildWindow(st, new Point(5, y)); guiFormaDeControl = new GUIHorizontalComboBox(new Size(InnerBounds.Width / 2 - 10, 24), new object[] { "Realista", "Arcade" }); AddDialogChildWindow(guiFormaDeControl, new Point(5 + InnerBounds.Width / 2, y)); y += 30; //Velocidad Rotación Inicial st = new GUIStatic(new Size(1, 1)); st.Text = "Vel. Rotación Inicial (grados/segundo): "; AddDialogChildWindow(st, new Point(5, y)); guiVelocidadRotacionInicial = new GUINumeric(new Size(InnerBounds.Width / 2 - 10, 24)); guiVelocidadRotacionInicial.MaxValue = 720.0f; guiVelocidadRotacionInicial.MinValue = 10.0f; guiVelocidadRotacionInicial.StepValue = 10.0f; AddDialogChildWindow(guiVelocidadRotacionInicial, new Point(5 + InnerBounds.Width / 2, y)); y += 30; //Velocidad Rotación Final st = new GUIStatic(new Size(1, 1)); st.Text = "Vel. Rotación Final (grados/segundo): "; AddDialogChildWindow(st, new Point(5, y)); guiVelocidadRotacionFinal = new GUINumeric(new Size(InnerBounds.Width / 2 - 10, 24)); guiVelocidadRotacionFinal.MaxValue = 720.0f; guiVelocidadRotacionFinal.MinValue = 10.0f; guiVelocidadRotacionFinal.StepValue = 10.0f; AddDialogChildWindow(guiVelocidadRotacionFinal, new Point(5 + InnerBounds.Width / 2, y)); y += 30; //Tiempo Aceleración Rotación st = new GUIStatic(new Size(1, 1)); st.Text = "Tiempo Aceleración Rotacion (segundos): "; AddDialogChildWindow(st, new Point(5, y)); guiTiempoAceleracionRotacion = new GUINumeric(new Size(InnerBounds.Width / 2 - 10, 24)); guiTiempoAceleracionRotacion.MaxValue = 2.0f; guiTiempoAceleracionRotacion.MinValue = 0.0f; guiTiempoAceleracionRotacion.StepValue = 0.1f; AddDialogChildWindow(guiTiempoAceleracionRotacion, new Point(5 + InnerBounds.Width / 2, y)); y += 30; //Botones y = InnerBounds.Height - 30; GUIButton btnAceptar = new GUIButton(new Size(60, 24)); btnAceptar.Text = "Guardar"; btnAceptar.ButtonPressed += new GUIButton.ButtonPressedHandler(btnAceptar_ButtonPressed); AddDialogChildWindow(btnAceptar, new Point(5, y)); GUIButton btnCancelar = new GUIButton(new Size(60, 24)); btnCancelar.Text = "Cancelar"; btnCancelar.ButtonPressed += new GUIButton.ButtonPressedHandler(btnCancelar_ButtonPressed); AddDialogChildWindow(btnCancelar, new Point(InnerBounds.Width - btnCancelar.Size.Width - 5, y)); FocusNextChild(); //Cargo la configuración en la pantalla guiPantallaCompleta.Checked = Properties.Settings.Default.PantallaCompleta; guiVelocidadRotacionInicial.Value = Properties.Settings.Default.VelocidadRotacionInicial; guiVelocidadRotacionFinal.Value = Properties.Settings.Default.VelocidadRotacionFinal; guiTiempoAceleracionRotacion.Value = Properties.Settings.Default.TiempoAceleracionRotacion; foreach (Resolucion res in guiResolucion.Items) { if (res.size == Properties.Settings.Default.Resolucion) { guiResolucion.SelectedItem = res; break; } } foreach (int bits in guiBitsDeColor.Items) { if (bits == Properties.Settings.Default.ProfundidadBits) { guiBitsDeColor.SelectedItem = bits; break; } } foreach (String s in guiFormaDeControl.Items) { if (s.Equals(Properties.Settings.Default.FormaDeControl)) { guiFormaDeControl.SelectedItem = s; break; } } }
public void CreateGui() { // menu niveau GUIItemV2 edition = new GUIItemV2 (0, 0, TextManager.GetText("PoolDesigner.Edit"), "leftOutilOn", "leftOutilOff", this, true); GUIItemV2 snap = new GUIItemV2 (0, 1, TextManager.GetText("PoolDesigner.Snap"), "leftOutilOn", "leftOutilOff", this, true); GUIItemV2 plan = new GUIItemV2 (0, 2, TextManager.GetText("PoolDesigner.Plan"), "leftOutilOn", "leftOutilOff", this, true); GUIItemV2 img = new GUIItemV2 (0, 5, TextManager.GetText("PoolDesigner.Image"), "leftOutilOn", "leftOutilOff", this, true); GUIItemV2 cotation = new GUIItemV2 (0, 6, TextManager.GetText("PoolDesigner.Cotation"), "leftOutilOn", "leftOutilOff", this, true); // snap _alignedSnapping = new GUICheckbox (1, 0, TextManager.GetText("PoolDesigner.AlignedSnap"), "leftOutilOn", "leftOutilOff", this); _alignedSnapping.SetValue (true); _angleSnapping = new GUICheckbox (1, 1, TextManager.GetText("PoolDesigner.AngleSnap"), "leftOutilOn", "leftOutilOff", this); snap.addSubItem (_alignedSnapping); //snap.addSubItem (_angleSnapping); // cotation _squareCotation = new GUICheckbox (1, 2, TextManager.GetText("PoolDesigner.SquareCotation"), "leftOutilOn", "leftOutilOff", this); _edgeCotation = new GUICheckbox (1, 3, TextManager.GetText("PoolDesigner.EdgeCotation"), "leftOutilOn", "leftOutilOff", this); _edgeCotation.SetValue (true); cotation.addSubItem (_squareCotation); cotation.addSubItem (_edgeCotation); // GUIItemV2 zoomToPoly = new GUIItemV2 (1, 2, TextManager.GetText("PoolDesigner.ZoomToPoly"), "leftOutilOn", "leftOutilOff", this); //plan.addSubItem (zoomToPoly); GUIItemMultiBtn validCancelReset = new GUIItemMultiBtn (0, "multi_bg", "", "", this, 20, true); GUIAutoItem clear = new GUIAutoItem (1, "", "clear", "clear", this); clear.doEvent += Clear; validCancelReset.addSubItem (clear); GUIAutoItem reset = new GUIAutoItem (1, "", "reset", "reset", this); reset.doEvent += Reset; validCancelReset.addSubItem (reset); GUIAutoItem valid = new GUIAutoItem (1, "", "valid", "valid", this); valid.doEvent += Validate; validCancelReset.addSubItem (valid); _curveSlider = new GUIHSlider (0, 3, "rightOutilOn", "rightOutilOff", this); GUIItemV2 delete = new GUIItemV2 (0, 4, TextManager.GetText("PoolDesigner.RemovePoint"), "rightOutilOn", "rightOutilOff", this); // menu image niveaux 0 GUIItemV2 load = new GUIItemV2 (0, 7, TextManager.GetText("PoolDesigner.Image.Load"), "rightOutilOn", "rightOutilOff", this); _showHideBackgroundImage = new GUICheckbox (0, 8, TextManager.GetText("PoolDesigner.Image.ShowHide"), "rightOutilOn", "rightOutilOff", this); _showHideBackgroundImage.SetValue (true); GUIItemV2 scale = new GUIItemV2 (0, 9, TextManager.GetText("PoolDesigner.Image.Scale"), "rightOutilOn", "rightOutilOff", this); GUIItemV2 position = new GUIItemV2 (0, 10, TextManager.GetText("PoolDesigner.Image.Move"), "rightOutilOn", "rightOutilOff", this); GUIItemV2 removeImg = new GUIItemV2 (0, 11, TextManager.GetText("PoolDesigner.Image.Remove"), "rightOutilOn", "rightOutilOff", this); LeftRoot = new GUIItemV2 (-1, -1, "Root", "", "", this); LeftRoot.addSubItem (edition); LeftRoot.addSubItem (snap); LeftRoot.addSubItem (plan); LeftRoot.addSubItem (img); LeftRoot.addSubItem (cotation); LeftRoot.addSubItem (validCancelReset); RightRoot = new GUIItemV2 (-1, -1, "Root", "", "", this); RightRoot.addSubItem (_curveSlider); RightRoot.addSubItem (delete); bgImgRoot = new GUIItemV2 (-1, -1, "Root", "", "", this); bgImgRoot.addSubItem (load); bgImgRoot.addSubItem (_showHideBackgroundImage); bgImgRoot.addSubItem (scale); bgImgRoot.addSubItem (position); bgImgRoot.addSubItem (removeImg); LeftTitle = new GUIItemV2 (-1, -1, TextManager.GetText("PoolDesigner.LeftTitle"), "leftTitle", "leftTitle", this); RightTitle = new GUIItemV2 (-1, -1, TextManager.GetText("PoolDesigner.RightTitle"), "rightTitle", "rightTitle", this); bgImgTitle = new GUIItemV2 (-1, -1, TextManager.GetText("PoolDesigner.Image"), "rightTitle", "rightTitle", this); leftMenuGroup = new Rect(leftOff7, 0, 300, UnityEngine.Screen.height); rightMenuGroup = new Rect(rightOff7, 0, 300, UnityEngine.Screen.height); bgImgMenuGroup = new Rect(bgImgOff7, 0, 300, UnityEngine.Screen.height); leftRect = new Rect(leftOff7, UnityEngine.Screen.height / 2 - 200, 260, 420); rightRect = new Rect(rightOff7, UnityEngine.Screen.height / 2 - 100, 260, 200); bgImgRect = new Rect(bgImgOff7, UnityEngine.Screen.height / 2 - 150, 280, 300); LeftRoot.setSelected (0); canDisp = true; }