Example #1
0
        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);
        }
Example #2
0
        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;
                }
            }
        }