当前位置: 首页>>代码示例>>C#>>正文


C# GameWindow.Dispose方法代码示例

本文整理汇总了C#中OpenTK.GameWindow.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# GameWindow.Dispose方法的具体用法?C# GameWindow.Dispose怎么用?C# GameWindow.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenTK.GameWindow的用法示例。


在下文中一共展示了GameWindow.Dispose方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        public static void Main()
        {
            // Create static (global) window instance
            Window = new OpenTK.GameWindow();

            // Hook up the initialize callback
            Window.Load += new EventHandler<EventArgs>(Initialize);
            // Hook up the update callback
            Window.UpdateFrame += new EventHandler<FrameEventArgs>(Update);
            // Hook up the render callback
            Window.RenderFrame += new EventHandler<FrameEventArgs>(Render);
            // Hook up the shutdown callback
            Window.Unload += new EventHandler<EventArgs>(Shutdown);

            // Set window title and size
            Window.Title = "Game Name";
            Window.ClientSize = new Size(30*8, 30*6);
            Window.VSync = VSyncMode.On;
            // Run the game at 60 frames per second. This method will NOT return
            // until the window is closed.
            Window.Run(60.0f);

            // If we made it down here the window was closed. Call the windows
            // Dispose method to free any resources that the window might hold
            Window.Dispose();

            #if DEBUG
            Console.WriteLine("\nFinished executing, press any key to exit...");
            Console.ReadKey();
            #endif
        }
开发者ID:Mszauer,项目名称:TileBasedGames,代码行数:31,代码来源:Program.cs

示例2: Main

        public static void Main()
        {
            //create static(global) window instance
            Window = new OpenTK.GameWindow();

            //hook up the initialize callback
            Window.Load += new EventHandler<EventArgs>(Initialize);
            //hook up the update callback
            Window.UpdateFrame += new EventHandler<FrameEventArgs>(Update);
            //hook up render callback
            Window.RenderFrame += new EventHandler<FrameEventArgs>(Render);
            //hook up shutdown callback
            Window.Unload += new EventHandler<EventArgs>(Shutdown);
            Window.VSync = VSyncMode.On;

            //set window title and size
            Window.Title = "Game Name";
            Window.ClientSize = new Size(800, 600);
            //run game at 60fps. will not return until window is closed
            Window.Run(60.0f);

            Window.Dispose();
            #if DEBUG
            Console.ReadLine();
            #endif
        }
开发者ID:Mszauer,项目名称:2DOpenTkFrameWork,代码行数:26,代码来源:MainWindow.cs

示例3: Window

        public Window(int Width, int Height, string Title, bool UseOGLThree = false)
        {
            var tempWindowForContext = new GameWindow(100, 100) { Visible = false };
            GL.GetFloat(GetPName.MajorVersion, out major);
            GL.GetFloat(GetPName.MinorVersion, out minor);
            tempWindowForContext.Dispose();

            Firefly.LatestAvailableVersion = (int)major * 10 + (int)minor;

            GameWindow = new GameWindow(Width, Height,
                new GraphicsMode(new ColorFormat(8, 8, 8, 8),//RGBA
                    8, 8, 8),//Depth, stencil, samples
                Title,
                GameWindowFlags.Default,//Fullscreen/windowed
                DisplayDevice.Default, //Monitor
                UseOGLThree ? 3 : 2, UseOGLThree ? 0 : 0, UseOGLThree ? GraphicsContextFlags.ForwardCompatible : GraphicsContextFlags.Default);//OGL version
            GameWindow.VSync = VSyncMode.Off;
        }
开发者ID:LukaHorvat,项目名称:Electric,代码行数:18,代码来源:Window.cs

示例4: Main

        public static void Main(string[] args) {
            //create new window
            Window = new MainGameWindow();
            Axiis = new Grid();
            TheGame = new CameraExample();
            TheGame.Resize(Window.Width, Window.Height);
            Window.Load += new EventHandler<EventArgs>(Initialize);
            Window.UpdateFrame += new EventHandler<FrameEventArgs>(Update);
            Window.RenderFrame += new EventHandler<FrameEventArgs>(Render);
            Window.Unload += new EventHandler<EventArgs>(Shutdown);

            Window.Title = "Game Name";
            Window.ClientSize = new System.Drawing.Size(800, 600);
            Window.VSync = VSyncMode.On;
            //run 60fps
            Window.Run(60.0f);

            //Dispose at end
            Window.Dispose();
        }
开发者ID:Mszauer,项目名称:OpenGL1X,代码行数:20,代码来源:Program.cs

示例5: CAdapter

        public CAdapter()
        {
            var tempWindow = new GameWindow();
            GraphicsMode bestMode = tempWindow.Context.GraphicsMode;
            var tempContext = new Context(tempWindow.Context);
            var implementation = tempContext.Implementation;
            apiVersion = new ApiVersion((byte)implementation.MajorVersion, (byte)implementation.MinorVersion);
            restrictions = new AdapterRestrictions
            {
                UniformBufferSlots = tempContext.Implementation.MaxUniformBufferBindings,
                SamplerSlots = tempContext.Implementation.MaxCombinedTextureImageUnits, // todo Make those separate
                ShaderResourceSlots = tempContext.Implementation.MaxCombinedTextureImageUnits,
                UnorderedAccessResourceSlots = 0, // todo Set it
                MaxVertexStreams = tempContext.Implementation.MaxVertexAttributes,
                MaxVertexStreamElementCount = 16, // todo: set it
                MaxStreamOutputTargets = tempContext.Implementation.MaxTransformFeedbackSeparateComponents, // todo: make sure
                MaxViewports = tempContext.Implementation.MaxViewports,
                MaxRenderTargets = tempContext.Implementation.MaxColorAttachments,
                MaxThreadGroupsX = 0, // todo: set it,
                MaxThreadGroupsY = 0, // todo: set it,
                MaxThreadGroupsZ = 0,  // todo: set it
                MaxThreadGroupsTotal = 0
            };

            adapterDesc = new AdapterDescription
            {
                Description = GL.GetString(StringName.Renderer),
                VendorId = 0,
                DeviceId = 0,
                SubSysId = 0,
                Revision = 0,
                DedicatedVideoMemory = 0,
                DedicatedSystemMemory = 0,
                SharedSystemMemory = 0,
                AdapterLuidHigh = 0,
                AdapterLuidLow = 0,
                Flags = AdapterFlags.None
            };

            tempWindow.Dispose();

            outputs = GetAvailableDisplays().Select((d, i) => new COutput(d, i)).ToArray();

            //foreach (var format in DisplayColorFormats)
            //{
            //    var expectedColorFormat = CtObjectGL.ColorFormat(format);
            //
            //    tempWindow = new GameWindow(1, 1, new GraphicsMode(expectedColorFormat, bestMode.Depth, bestMode.Stencil));
            //    var actualColorFormat = tempWindow.Context.GraphicsMode.ColorFormat;
            //    tempWindow.Dispose();
            //
            //    if (expectedColorFormat.Red == actualColorFormat.Red &&
            //        expectedColorFormat.Green == actualColorFormat.Green &&
            //        expectedColorFormat.Blue == actualColorFormat.Blue &&
            //        expectedColorFormat.Alpha == actualColorFormat.Alpha)
            //    {
            //        supportedDisplayFormats.Add(format);
            //    }
            //}
        }
开发者ID:Zulkir,项目名称:Beholder,代码行数:60,代码来源:CAdapter.cs

示例6: Run

        public void Run()
        {
            _gameWindow = new GameWindow(1280, 720);

            try
            {
                _gameWindow.Title = "CubeHack";
                _gameWindow.VSync = VSyncMode.On;

                /* This sequence seems necessary to bring the window to the front reliably. */
                _gameWindow.WindowState = WindowState.Maximized;
                _gameWindow.WindowState = WindowState.Minimized;
                _gameWindow.Visible = true;
                _gameWindow.WindowState = WindowState.Maximized;

                _gameWindow.KeyDown += OnKeyDown;
                _gameWindow.KeyPress += OnKeyPress;
                _gameWindow.KeyUp += OnKeyUp;

                _gameLoop.RenderFrame += RenderFrame;
                try
                {
                    _gameLoop.Run(_gameWindow);
                }
                finally
                {
                    _gameLoop.RenderFrame -= RenderFrame;
                }
            }
            finally
            {
                _gameWindow.Dispose();
                _gameWindow = null;
            }
        }
开发者ID:AndiAngerer,项目名称:cubehack,代码行数:35,代码来源:GameApp.cs


注:本文中的OpenTK.GameWindow.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。