Exemplo n.º 1
0
        /// <summary>
        /// Application IDLE
        /// </summary>
        private void Application_Idle(object sender, EventArgs e)
        {
            try
            {
                m_game.RunOneFrame();
            }
            catch (Exception)
            {
            }

            Invalidate();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Form Loaded
        /// </summary>
        private void Evt_Loaded(object sender, EventArgs e)
        {
            //Create MonoGame Wnd for 3D display
            // Can't change parent windows !?
            m_game = new Game1();

            m_game.IsMouseVisible           = true;
            m_game.Window.AllowUserResizing = false;
            m_game.Window.AllowAltF4        = false;

            m_game.RunOneFrame();

            //Create Primitives List
            var gd = m_game.GraphicsDevice;

            m_primitivesList = new BindingList <GeometricPrimitive>();
            m_primitivesList.Add(new CubePrimitive(gd));
            m_primitivesList.Add(new SpherePrimitive(gd));
            m_primitivesList.Add(new CylinderPrimitive(gd));
            m_primitivesList.Add(new TorusPrimitive(gd));
            m_primitivesList.Add(new TeapotPrimitive(gd));


            //UI init
            toolStripComboBoxModel.ComboBox.DataSource = m_primitivesList;
            textureSlotsUserControl1.Game1             = m_game;

            //Load default textures
            textureSlotsUserControl1.SetTextureSlot(0, "texture01.jpg");

            //IDLE event for 3D Drawing
            Application.Idle += Application_Idle;

            //Start Default effect
            using (var stream = File.OpenText("SimpleColor.fx"))
            {
                var shader = stream.ReadToEnd();
                m_scintillaCtrl.Text = shader;
                m_scintillaCtrl.SetSavePoint();

                DoBuild(shader);
            }

            //Help
            webBrowserHelp.Navigate(Path.Combine(Environment.CurrentDirectory, "HLSL_Help.html"));

            //Test...
            //HighlightWord("float4");
        }
Exemplo n.º 3
0
        /// <summary>
        /// Form Loaded
        /// </summary>
        private void Evt_Loaded(object sender, EventArgs e)
        {
            //Create MonoGame Wnd for 3D display
            // Can't change parent windows !?
            m_game = new Game1();

            m_game.IsMouseVisible = true;
            m_game.Window.AllowUserResizing = false;
            m_game.Window.AllowAltF4 = false;

            m_game.RunOneFrame();

            //Create Primitives List
            var gd = m_game.GraphicsDevice;

            m_primitivesList = new BindingList<GeometricPrimitive>();
            m_primitivesList.Add(new CubePrimitive(gd));
            m_primitivesList.Add(new SpherePrimitive(gd));
            m_primitivesList.Add(new CylinderPrimitive(gd));
            m_primitivesList.Add(new TorusPrimitive(gd));
            m_primitivesList.Add(new TeapotPrimitive(gd));


            //UI init
            toolStripComboBoxModel.ComboBox.DataSource = m_primitivesList;
            textureSlotsUserControl1.Game1 = m_game;

            //Load default textures
            textureSlotsUserControl1.SetTextureSlot(0, "texture01.jpg");

            //IDLE event for 3D Drawing
            Application.Idle += Application_Idle;

            //Start Default effect
            using (var stream = File.OpenText("SimpleColor.fx"))
            {
                var shader = stream.ReadToEnd();
                m_scintillaCtrl.Text = shader;
                m_scintillaCtrl.SetSavePoint();

                DoBuild(shader);
            }

            //Help
            webBrowserHelp.Navigate(Path.Combine(Environment.CurrentDirectory, "HLSL_Help.html"));

            //Test...
            //HighlightWord("float4");
        }
Exemplo n.º 4
0
        /// <summary>
        /// Form Loaded
        /// </summary>
        private void Evt_Loaded(object sender, EventArgs e)
        {
            //文件
            Config = ConfigHelper.ReadAllConfig <ConfigData>();

            if (String.IsNullOrEmpty(Config.LastOpenendPath))
            {
                Config.LastOpenendPath = "SimpleColor.fx";
            }
            if (String.IsNullOrEmpty(Config.TexturePath))
            {
                Config.TexturePath = "texture01.jpg";
            }


            //applyconfig

            //Create MonoGame Wnd for 3D display
            // Can't change parent windows !?
            m_game = new Game1();

            m_game.IsMouseVisible           = true;
            m_game.Window.AllowUserResizing = false;
            m_game.Window.AllowAltF4        = false;

            m_game.RunOneFrame();


            //Create Primitives List
            var gd = m_game.GraphicsDevice;

            m_primitivesList = new BindingList <GeometricPrimitive>();
            m_primitivesList.Add(new CubePrimitive(gd));
            m_primitivesList.Add(new SpherePrimitive(gd));
            m_primitivesList.Add(new CylinderPrimitive(gd));
            m_primitivesList.Add(new TorusPrimitive(gd));
            m_primitivesList.Add(new TeapotPrimitive(gd));


            //UI init
            toolStripComboBoxModel.ComboBox.DataSource = m_primitivesList;
            textureSlotsUserControl1.Game1             = m_game;

            //Load default textures
            textureSlotsUserControl1.SetTextureSlot(0, Config.TexturePath);

            //IDLE event for 3D Drawing
            Application.Idle += Application_Idle;

            //Start Default effect
            using (var stream = File.OpenText(Config.LastOpenendPath))
            {
                var shader = stream.ReadToEnd();
                m_scintillaCtrl.Text = shader;
                m_scintillaCtrl.SetSavePoint();

                DoBuild(shader);
            }

            //Help
            webBrowserHelp.Navigate(Path.Combine(Environment.CurrentDirectory, "HLSL_Help.html"));


            //Test...
            //HighlightWord("float4");

            //(new Thread(() => { Thread.Sleep(10000);
            //        Debug.Print("test");
            //        m_game.ChangeRenderMode(Config.RenderMode);

            //        Thread.Sleep(300); }
            //)).Start();
            ChangeWindowSize(Config.RecWidth, Config.RecWidth);
            ChangeRenderMode(Config.RenderMode);
        }