This is the main type for your game.
상속: Microsoft.Xna.Framework.Game
예제 #1
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");
        }