private void MainForm_Load(object sender, EventArgs e)
        {
            //Show the App before we init
            this.Show();
            this.panel3d.Focus();

            MainForm.ApplicationRunning = true;
            GuiController.newInstance();
            GuiController guiController = GuiController.Instance;

            guiController.initGraphics(this, panel3d);
            this.resetMenuOptions();


            while (MainForm.ApplicationRunning)
            {
                //Solo renderizamos si la aplicacion tiene foco, para no consumir recursos innecesarios
                if (this.ContainsFocus)
                {
                    guiController.render();
                }
                //Contemplar también la ventana del modo FullScreen
                else if (this.FullScreenEnable && guiController.FullScreenPanel.ContainsFocus)
                {
                    guiController.render();
                }
                else
                {
                    //Si no tenemos el foco, dormir cada tanto para no consumir gran cantida de CPU
                    System.Threading.Thread.Sleep(100);
                }

                // Process application messages
                Application.DoEvents();
            }

            //shutDown();
        }
Example #2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            //Configuracion de ventana principal
            this.Text = config.title;
            if (!config.showTitleBar)
            {
                this.ControlBox = false;
                this.Text       = null;
            }

            //Modo fullscreen
            if (this.config.fullScreenMode)
            {
                //Quitar todos los paneles que no queremos que se vean
                this.Controls.Clear();
                this.splitContainerUserVars.Panel1.Controls.Remove(this.panel3d);
                this.splitContainerModifiers.Panel1.Controls.Remove(this.groupBoxModifiers);

                //Acomodar paneles para fullscreen
                if (config.showModifiersPanel)
                {
                    SplitContainer sp = new SplitContainer();
                    sp.Orientation      = Orientation.Vertical;
                    sp.Dock             = DockStyle.Fill;
                    sp.SplitterDistance = 600;
                    sp.IsSplitterFixed  = true;
                    sp.Panel1.Controls.Add(this.panel3d);
                    sp.Panel2.Controls.Add(this.groupBoxModifiers);
                    this.Controls.Add(sp);
                }
                else
                {
                    this.Controls.Add(this.panel3d);
                }
            }


            //Show the App before we init
            this.Show();
            this.panel3d.Focus();

            MainForm.ApplicationRunning = true;
            GuiController.newInstance();
            GuiController guiController = GuiController.Instance;

            guiController.initGraphics(this, panel3d);
            this.resetMenuOptions();

            while (MainForm.ApplicationRunning)
            {
                //Solo renderizamos si la aplicacion tiene foco, para no consumir recursos innecesarios
                if (this.applicationActive())
                {
                    guiController.render();
                }
                //Contemplar también la ventana del modo FullScreen
                else if (this.FullScreenEnable && guiController.FullScreenPanel.ContainsFocus)
                {
                    guiController.render();
                }
                else
                {
                    //Si no tenemos el foco, dormir cada tanto para no consumir gran cantida de CPU
                    System.Threading.Thread.Sleep(100);
                }

                // Process application messages
                Application.DoEvents();
            }

            //shutDown();
        }